<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to store values in token from specific cell of a table ? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/588386#M48260</link>
    <description>Great solutions! It also helped me, thanks Sundareshr</description>
    <pubDate>Thu, 10 Mar 2022 10:50:51 GMT</pubDate>
    <dc:creator>Vachel</dc:creator>
    <dc:date>2022-03-10T10:50:51Z</dc:date>
    <item>
      <title>How to store values in token from specific cell of a table ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243415#M43512</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;We generate table of data and want to extract data from specific cell of table and store it in token.&lt;/P&gt;

&lt;P&gt;Example Table:&lt;BR /&gt;
Column1 Average     Standard Deviation  Median&lt;BR /&gt;
All                            a                        b                              c&lt;BR /&gt;
A                              x                        y                             z&lt;BR /&gt;
B                              e                        f                              g&lt;/P&gt;

&lt;P&gt;I want to extract the value of Median of Row A i.e. "z" and store it to some token.&lt;/P&gt;

&lt;P&gt;Regards&lt;BR /&gt;
Ankit&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 11:03:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243415#M43512</guid>
      <dc:creator>AKG1_old1</dc:creator>
      <dc:date>2016-10-12T11:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to store values in token from specific cell of a table ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243416#M43513</link>
      <description>&lt;P&gt;Is this table on a dashboard? How do you intend to use the stored value?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 11:41:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243416#M43513</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-12T11:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to store values in token from specific cell of a table ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243417#M43514</link>
      <description>&lt;P&gt;yes, we run query to populate these tables on dashboard. &lt;/P&gt;

&lt;P&gt;I want to grep that value of specific cell. So i can store that data to some csv file using token. &lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 11:45:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243417#M43514</guid>
      <dc:creator>AKG1_old1</dc:creator>
      <dc:date>2016-10-12T11:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to store values in token from specific cell of a table ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243418#M43515</link>
      <description>&lt;P&gt;You can either do this a couple of ways based on the use case&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;In JS&lt;/STRONG&gt;&lt;BR /&gt;
If you want to do this programatically, you will have to write custom Javascript.  Let's assume you have a table defined in XML and the search is called "median_search".&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   &amp;lt;row&amp;gt;
     &amp;lt;panel&amp;gt;
       &amp;lt;table&amp;gt;
         &amp;lt;search id="median_search"&amp;gt;
           &amp;lt;query&amp;gt; ... | your search | ... &amp;lt;/query&amp;gt;
         &amp;lt;/search&amp;gt;
       &amp;lt;/table&amp;gt;
     &amp;lt;/panel&amp;gt;
   &amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The corresponding Javascript to get the median value would look something like this,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    var median_search = mvc.Components.getInstance("median_search");

    var searchResults = median_search.data('results', {
      output_mode: 'json_rows',
      count: 0
    });

    searchResults.on("data", function() {
      if (searchResults.hasData()) {
         var results = searchResults.data().rows;
         var length = results.length;
         var column1 = searchResults.data().fields.indexOf("Column1");
         var medianColumn = searchResults.data().fields.indexOf("Median");
         var searchTerm = "The Column1 VALUE YOU ARE LOOKING FOR";

        for (var j = 0; j &amp;lt; length; j++) {
          if (results[j][column1] === searchTerm) {
            submittedTokenModel.set("median_token", parseFlow(results[j][medianColumn]));
            break;
          }
      }
});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Oct 2016 11:46:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243418#M43515</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2016-10-12T11:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to store values in token from specific cell of a table ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243419#M43516</link>
      <description>&lt;P&gt;Thank you for reply but I think problem of using $row.Median$ is that it will store the median of all the rows.&lt;/P&gt;

&lt;P&gt;I need to extract only for one row i.e. A.&lt;/P&gt;

&lt;P&gt;for example:&lt;/P&gt;

&lt;P&gt;$A.Median$&lt;/P&gt;

&lt;P&gt;I know the above example will not work. But can we do similar like that.&lt;/P&gt;

&lt;P&gt;Thanks &lt;BR /&gt;
Ankit&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 12:31:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243419#M43516</guid>
      <dc:creator>AKG1_old1</dc:creator>
      <dc:date>2016-10-12T12:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to store values in token from specific cell of a table ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243420#M43517</link>
      <description>&lt;P&gt;The above example should only grab the value of the first row per the specification link.  Are you seeing it do otherwise?&lt;/P&gt;

&lt;P&gt;Regardless, the first example only works if you want the Median value for the first row. Do you know if you always want the first row, or do you need a flexible way to chose a specific row? If the latter, do you need the user to select the row or should software decide which row?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 12:41:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243420#M43517</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2016-10-12T12:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to store values in token from specific cell of a table ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243421#M43518</link>
      <description>&lt;P&gt;I want the second option. i don't want user to decide which row.&lt;/P&gt;

&lt;P&gt;Values in 1st column is constant i.e. A. Every time I want to store the value of median for A.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 12:46:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243421#M43518</guid>
      <dc:creator>AKG1_old1</dc:creator>
      <dc:date>2016-10-12T12:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to store values in token from specific cell of a table ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243422#M43519</link>
      <description>&lt;P&gt;Then the first example I posted should work.  I will double check.&lt;/P&gt;

&lt;P&gt;What version of Splunk are developing on? &lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 12:47:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243422#M43519</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2016-10-12T12:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to store values in token from specific cell of a table ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243423#M43520</link>
      <description>&lt;P&gt;How do you determine the row you want to get the value from? Is that a user selection or pre-determined? Also is the Median pre-calculated in the table or would that need to be calculated based on the values returned?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 12:48:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243423#M43520</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-12T12:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to store values in token from specific cell of a table ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243424#M43521</link>
      <description>&lt;P&gt;Enterprise 6.4&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 12:50:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243424#M43521</guid>
      <dc:creator>AKG1_old1</dc:creator>
      <dc:date>2016-10-12T12:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to store values in token from specific cell of a table ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243425#M43522</link>
      <description>&lt;P&gt;the first column is constant. from above example: I want the value of median for A. &lt;/P&gt;

&lt;P&gt;For Median, I have a query which calculate it and populate in the table.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 12:53:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243425#M43522</guid>
      <dc:creator>AKG1_old1</dc:creator>
      <dc:date>2016-10-12T12:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to store values in token from specific cell of a table ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243426#M43523</link>
      <description>&lt;P&gt;OK, I got it working on 6.4.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt; ... | your search | ... &amp;lt;/query&amp;gt;
          &amp;lt;finalized&amp;gt;
                &amp;lt;set token="median_token"&amp;gt;$result.Median$&amp;lt;/set&amp;gt;
          &amp;lt;/finalized&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;row&amp;lt;/option&amp;gt;
        &amp;lt;option name="count"&amp;gt;10&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Oct 2016 12:58:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243426#M43523</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2016-10-12T12:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to store values in token from specific cell of a table ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243427#M43524</link>
      <description>&lt;P&gt;Note the use of &lt;CODE&gt;finalized&lt;/CODE&gt; instead of &lt;CODE&gt;done&lt;/CODE&gt;. &lt;/P&gt;

&lt;P&gt;This does grab only the top row for me in 6.4&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 12:58:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243427#M43524</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2016-10-12T12:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to store values in token from specific cell of a table ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243428#M43525</link>
      <description>&lt;P&gt;Its not working, currently, I am using the same thing. its showing the median of 1st row. I want to store median for specific value. It can be displayed on different rows.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 13:03:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243428#M43525</guid>
      <dc:creator>AKG1_old1</dc:creator>
      <dc:date>2016-10-12T13:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to store values in token from specific cell of a table ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243429#M43526</link>
      <description>&lt;P&gt;Oh, I misunderstood you when you said "Every time I want to store the value of median for A" taking that to mean A would be the first row.&lt;/P&gt;

&lt;P&gt;Unless you are willing to sort the results so that the result for "A" is on top, then you will have to use JavaScript if you plan to show other results. &lt;/P&gt;

&lt;P&gt;I can share the JavaScript if you need that.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 13:07:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243429#M43526</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2016-10-12T13:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to store values in token from specific cell of a table ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243430#M43527</link>
      <description>&lt;P&gt;I have used A as an example. Name could be different. So sorting the column won't solve my problem.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 13:10:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243430#M43527</guid>
      <dc:creator>AKG1_old1</dc:creator>
      <dc:date>2016-10-12T13:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to store values in token from specific cell of a table ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243431#M43528</link>
      <description>&lt;P&gt;Then you need to share how you plan to identify which row to pull the median value, because that has to get translated into the JS that extracts the value from the multi-dimensional array that stores the table of results.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 13:17:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243431#M43528</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2016-10-12T13:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to store values in token from specific cell of a table ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243432#M43529</link>
      <description>&lt;P&gt;Here's how you can get it to work. First you need to add the value you want to a hidden column in your results set. You can do this by using the &lt;CODE&gt;eventstats&lt;/CODE&gt; command. Then in your use the &lt;CODE&gt;$result.hiddenfield$&lt;/CODE&gt; token to extract that value. Here is a run-anywhere sample. You should be able to modify the query to your needs.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard&amp;gt;
  &amp;lt;label&amp;gt;Test&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;title&amp;gt;Value from first row: $e$&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal | stats count by sourcetype | eventstats values(eval(if(sourcetype="splunkd", count, null()))) as _c&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-15m&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;finalized&amp;gt;
            &amp;lt;set token="e"&amp;gt;$result._c$&amp;lt;/set&amp;gt;
          &amp;lt;/finalized&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="wrap"&amp;gt;undefined&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;undefined&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;row&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Oct 2016 14:05:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/243432#M43529</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-12T14:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to store values in token from specific cell of a table ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/588386#M48260</link>
      <description>Great solutions! It also helped me, thanks Sundareshr</description>
      <pubDate>Thu, 10 Mar 2022 10:50:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-store-values-in-token-from-specific-cell-of-a-table/m-p/588386#M48260</guid>
      <dc:creator>Vachel</dc:creator>
      <dc:date>2022-03-10T10:50:51Z</dc:date>
    </item>
  </channel>
</rss>

