<?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: assign values to multiple variables with the case command in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/assign-values-to-multiple-variables-with-the-case-command/m-p/576440#M10822</link>
    <description>&lt;P&gt;I had tried something like this but without mvappend .... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;Tks for your solution so it works great !!!&lt;/P&gt;</description>
    <pubDate>Fri, 26 Nov 2021 15:01:44 GMT</pubDate>
    <dc:creator>antonio147</dc:creator>
    <dc:date>2021-11-26T15:01:44Z</dc:date>
    <item>
      <title>assign values to multiple variables with the case command</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/assign-values-to-multiple-variables-with-the-case-command/m-p/576412#M10816</link>
      <description>&lt;P&gt;hi,&lt;BR /&gt;I have a question to ask: can you assign values to multiple variables in Splunk with the case command?&lt;BR /&gt;I need that based on a filter chosen in the dashboard, it performs a different search based on what has been selected.&lt;BR /&gt;I have a filter with options: red, green, yellow, blue, black&lt;BR /&gt;If you choose red, the search must be:&lt;BR /&gt;search field1 = A AND field2 = B&lt;BR /&gt;if you choose green:&lt;BR /&gt;search field1 = C AND field2 = D AND field3 = E&lt;BR /&gt;if you choose yellow:&lt;BR /&gt;search field1 = X AND field2 = Y&lt;BR /&gt;.....&lt;BR /&gt;I wanted to use a case like:&lt;BR /&gt;eval KK, HH, JJ = case (&lt;BR /&gt;color = "red", KK = A, HH = B, JJ = "",&lt;BR /&gt;color = "green", KK = C, HH = D, JJ = E,&lt;BR /&gt;color = "yellow", KK = X, HH = Y, JJ = "",&lt;BR /&gt;1 = 1, "INV")&lt;/P&gt;&lt;P&gt;It can be done?&lt;BR /&gt;Or do I have to use as many cases as there are variables I need in the search?&lt;/P&gt;&lt;P&gt;Tks&lt;BR /&gt;Bye&lt;BR /&gt;Antonio&lt;/P&gt;</description>
      <pubDate>Fri, 26 Nov 2021 10:55:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/assign-values-to-multiple-variables-with-the-case-command/m-p/576412#M10816</guid>
      <dc:creator>antonio147</dc:creator>
      <dc:date>2021-11-26T10:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: assign values to multiple variables with the case command</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/assign-values-to-multiple-variables-with-the-case-command/m-p/576421#M10817</link>
      <description>&lt;P&gt;You can only assign to one field at a time - having said that, you could assign as a multi-value field and then use mvindex to assign the various parts to their respective fields.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Nov 2021 13:18:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/assign-values-to-multiple-variables-with-the-case-command/m-p/576421#M10817</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-11-26T13:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: assign values to multiple variables with the case command</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/assign-values-to-multiple-variables-with-the-case-command/m-p/576431#M10819</link>
      <description>&lt;P&gt;Hi ITWishperer,&lt;BR /&gt;Thanks for the reply.&lt;BR /&gt;That was what I was afraid of, I tried to search the community but to no avail.&lt;BR /&gt;Can you give me an example?&lt;BR /&gt;I haven't used mvindex yet, if I understand correctly, do I create a new field with the values I need and then do the split? to have the values separated and with coalesce do I check when it is null?&lt;/P&gt;&lt;P&gt;Tks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Nov 2021 13:48:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/assign-values-to-multiple-variables-with-the-case-command/m-p/576431#M10819</guid>
      <dc:creator>antonio147</dc:creator>
      <dc:date>2021-11-26T13:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: assign values to multiple variables with the case command</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/assign-values-to-multiple-variables-with-the-case-command/m-p/576433#M10820</link>
      <description>&lt;P&gt;Something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval mv = case (
color = "red", mvappend(A,B,""),
color = "green", mvappend(C,D,E),
color = "yellow", mvappend(X,Y,""),
1 = 1, mvappend("INV","INV","INV"))
eval KK = mvindex(mv,0), HH = mvindex(mv,1), JJ = mvindex(mv,2)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 26 Nov 2021 14:00:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/assign-values-to-multiple-variables-with-the-case-command/m-p/576433#M10820</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-11-26T14:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: assign values to multiple variables with the case command</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/assign-values-to-multiple-variables-with-the-case-command/m-p/576440#M10822</link>
      <description>&lt;P&gt;I had tried something like this but without mvappend .... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;Tks for your solution so it works great !!!&lt;/P&gt;</description>
      <pubDate>Fri, 26 Nov 2021 15:01:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/assign-values-to-multiple-variables-with-the-case-command/m-p/576440#M10822</guid>
      <dc:creator>antonio147</dc:creator>
      <dc:date>2021-11-26T15:01:44Z</dc:date>
    </item>
  </channel>
</rss>

