<?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: Simple XML Dashboard - Table Panel Formating Query in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dashboard-Table-Panel-Formating-Query/m-p/670822#M54900</link>
    <description>&lt;P&gt;Regardless of actually rendering it in your dashboard, if you have dynamically created set of fields, you can use the foreach command.&lt;/P&gt;&lt;P&gt;Like this (a run-anywhere example&lt;/P&gt;&lt;PRE&gt;| makeresults&lt;BR /&gt;| eval Agent1=0,Agent2=1&lt;BR /&gt;| foreach "Agent*"&lt;BR /&gt;    [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=if (&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;==1,"✓","x")]&lt;/PRE&gt;&lt;P&gt;The downside of the foreach command is that it's tricky with spaces within field names.&lt;/P&gt;</description>
    <pubDate>Tue, 05 Dec 2023 13:36:03 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2023-12-05T13:36:03Z</dc:date>
    <item>
      <title>Simple XML Dashboard - Table Panel Formating Query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dashboard-Table-Panel-Formating-Query/m-p/670815#M54897</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am creating a dashboard (Simple XML) with a table panel as shown below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="madhav_dholakia_0-1701779518632.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28377iF1CFC0999DBCB154/image-size/medium?v=v2&amp;amp;px=400" role="button" title="madhav_dholakia_0-1701779518632.png" alt="madhav_dholakia_0-1701779518632.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This is actually a dashboard for Telephony System and number of columns (and names, of course) will be changed based on which agents are logged in at a time. For example,&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;at 9 AM: Queue, Agent 1, Agent 4, Agent 9&lt;/LI&gt;&lt;LI&gt;at 3 PM: Queue, Agent 1, Agent 4, Agent 5, Agent 11&lt;/LI&gt;&lt;LI&gt;at 1 AM: Queue, Agent 5, Agent 9, Agent 11&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Now, in this table panel, I want to replace 1 with Green Tick and 0 with Red Cross in all the columns.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please suggest how this can be achieved? I have tried this using &lt;EM&gt;eval&lt;/EM&gt; and &lt;EM&gt;replace&lt;/EM&gt; but as columns are dynamic, I am unable to handle this.&lt;/P&gt;&lt;P&gt;Thank you.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Edit:&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Sample JSON Event:&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
AAAA_PMC_DT: 05-Dec-2023 13:04:34
Agent: Agent 1
Block: RTAgentsLoggedIn
Bound: in
Queue(s):: Queue 1, Queue 3, Queue 4, Queue 5, Queue 7, Queue 10
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;SPL:&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="telephony_test" Bound=in Block=RTAgentsLoggedIn _index_earliest=-5m@m _index_latest=@s
      | spath "Agent" 
| spath "Queue(s):" 
| spath "On pause" 
| spath AAAA_PMC_DT
| fields "Agent" "Queue(s):" "On pause" AAAA_PMC_DT 
| rename "Queue(s):" as Queue, "On pause" as OnPause, AAAA_PMC_DT as LastDataFetch
| eval _time=strptime(LastDataFetch,"%d-%b-%Y %H:%M:%S")
| where _time&amp;gt;=relative_time(now(),"-300s@s")
| where NOT LIKE(Queue,"%Outbound%")
| sort 0 -_time Agent
| dedup Agent
| eval Queue=split(Queue,", ")
| table Agent Queue
| mvexpand Queue
| chart limit=0 count by Queue Agent&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 13:12:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dashboard-Table-Panel-Formating-Query/m-p/670815#M54897</guid>
      <dc:creator>madhav_dholakia</dc:creator>
      <dc:date>2023-12-05T13:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Simple XML Dashboard - Table Panel Formating Query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dashboard-Table-Panel-Formating-Query/m-p/670822#M54900</link>
      <description>&lt;P&gt;Regardless of actually rendering it in your dashboard, if you have dynamically created set of fields, you can use the foreach command.&lt;/P&gt;&lt;P&gt;Like this (a run-anywhere example&lt;/P&gt;&lt;PRE&gt;| makeresults&lt;BR /&gt;| eval Agent1=0,Agent2=1&lt;BR /&gt;| foreach "Agent*"&lt;BR /&gt;    [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=if (&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;==1,"✓","x")]&lt;/PRE&gt;&lt;P&gt;The downside of the foreach command is that it's tricky with spaces within field names.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 13:36:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dashboard-Table-Panel-Formating-Query/m-p/670822#M54900</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-12-05T13:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: Simple XML Dashboard - Table Panel Formating Query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dashboard-Table-Panel-Formating-Query/m-p/670849#M54904</link>
      <description>&lt;P class="lia-align-left"&gt;thanks,&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;- this almost worked. Only thing is Columns "Agent 1, Agent 2, Agent 3 ...." are actual Agent Names so below will not work. How can I use this &lt;EM&gt;foreach&lt;/EM&gt; so it includes all columns except Column "Queue"?&lt;/P&gt;&lt;PRE&gt;| foreach "Agent*"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Thank you.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Edit:&lt;/STRONG&gt; I was able to handle spaces within the field names referring to below link:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.splunk.com/t5/Splunk-Search/Foreach-fails-if-field-contains-colon-or-dot/m-p/487408" target="_blank"&gt;https://community.splunk.com/t5/Splunk-Search/Foreach-fails-if-field-contains-colon-or-dot/m-p/487408&amp;nbsp;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 14:53:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dashboard-Table-Panel-Formating-Query/m-p/670849#M54904</guid>
      <dc:creator>madhav_dholakia</dc:creator>
      <dc:date>2023-12-05T14:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Simple XML Dashboard - Table Panel Formating Query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dashboard-Table-Panel-Formating-Query/m-p/670852#M54905</link>
      <description>&lt;P&gt;You can try like this:&lt;/P&gt;&lt;PRE&gt;| makeresults&lt;BR /&gt;| eval Title="title",'First name'=1,'Second name'=0&lt;BR /&gt;| foreach "*"&lt;BR /&gt;    [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=if ("&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;"=="Title","Title",if(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=1,"Yes","No")) ]&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Dec 2023 15:01:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dashboard-Table-Panel-Formating-Query/m-p/670852#M54905</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-12-05T15:01:14Z</dc:date>
    </item>
    <item>
      <title>Re: Simple XML Dashboard - Table Panel Formating Query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dashboard-Table-Panel-Formating-Query/m-p/670915#M54907</link>
      <description>&lt;P&gt;Slight variation on&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;example, your foreach statement only needs to be&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| foreach "*"
    [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=case('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'=0, "&lt;span class="lia-unicode-emoji" title=":cross_mark:"&gt;❌&lt;/span&gt;",
                          '&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'&amp;gt;0, "&lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt;",
                          1==1, '&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;')
    ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;The above allows for count &amp;gt; 1 with the green tick, but if it will either be 0 or 1 then you can make it so&lt;/P&gt;&lt;P&gt;There is no need to test for the queue name, as long as it's never numeric&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 23:18:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dashboard-Table-Panel-Formating-Query/m-p/670915#M54907</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-12-05T23:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: Simple XML Dashboard - Table Panel Formating Query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dashboard-Table-Panel-Formating-Query/m-p/670938#M54912</link>
      <description>&lt;P&gt;thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 07:24:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dashboard-Table-Panel-Formating-Query/m-p/670938#M54912</guid>
      <dc:creator>madhav_dholakia</dc:creator>
      <dc:date>2023-12-06T07:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: Simple XML Dashboard - Table Panel Formating Query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dashboard-Table-Panel-Formating-Query/m-p/670941#M54913</link>
      <description>&lt;P&gt;thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;- Unfortunately, I could not accept 2 answers but this helped. Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 07:25:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dashboard-Table-Panel-Formating-Query/m-p/670941#M54913</guid>
      <dc:creator>madhav_dholakia</dc:creator>
      <dc:date>2023-12-06T07:25:59Z</dc:date>
    </item>
  </channel>
</rss>

