Dashboards & Visualizations

Splunk <fields> equivalent in JavaScript

deepikagooty
Explorer

Hello,

I have a table on my splunk dashboard. I have a search to get the data and I am using fields to filter out the columns that I want to see on my dashboard. I observed that, even if I filter out a couple of columns to display, I am still able to use the other column data (column c or d from below example) that I am not displaying for other purpose. Below is the format that I am using for a splunk table.

 

<search>
<query>| dbxquery connection=connection query="SELECT a, b, c, d FROM t1"
</query>
</search>
<fields>["a", "b"]</fields>

 

Now, I have a requirement to create a custom Splunk table using JavaScript. I was able to do the same but I am not sure how to use the <fields> provided by Splunk in JavaScript. The problem that I observed with JavaScript table is that, If I am not displaying a particular column, I will not be able to use that column data for other operations. I basically want to display just a, b columns from my JavaScript query but at the same time utilize the c, d column data for other operations. Kindly suggest a solution for this.

Labels (2)
0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

If you are using a TableView in JS, it also appears to support the fields attribute

https://docs.splunk.com/DocumentationStatic/WebFramework/1.0/compref_table.html

 

View solution in original post

bowesmana
SplunkTrust
SplunkTrust

If you are using a TableView in JS, it also appears to support the fields attribute

https://docs.splunk.com/DocumentationStatic/WebFramework/1.0/compref_table.html

 

deepikagooty
Explorer

Awesome. That worked. Thank you so much 😀

 

I have used myTable.settings.set("fields", ["a", "b", "c"]); after initializing myTable (TableView)

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...