<?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: Take value from one field and return the value in a second field with the same name as that value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Take-value-from-one-field-and-return-the-value-in-a-second-field/m-p/118746#M31745</link>
    <description>&lt;P&gt;Here are my statements, starting from the relevant portion:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval yr="$form.yr$" | eval quarter="$form.quarter$" | eval yr=if("$form.quarter$"="Q1" OR "$form.quarter$"="Q2",yr-1,yr) | eval monthSearch=if("$form.quarter$"="Q1",'yr'+"07 "+'yr'+"08 "+'yr'+"09 ",monthSearch) | eval monthSearch=if("$form.quarter$"="Q2",'yr'+"10 "+'yr'+"11 "+'yr'+"12 ",monthSearch) | eval monthSearch=if("$form.quarter$"="Q3",'yr'+"01 "+'yr'+"02 "+'yr'+"03 ",monthSearch) | eval monthSearch=if("$form.quarter$"="Q4",'yr'+"04 "+'yr'+"05 "+'yr'+"06 ",monthSearch) | makemv monthSearch | eval monthSearch1=mvindex(monthSearch,0) | eval monthSearch2=mvindex(monthSearch,1) | eval monthSearch3=mvindex(monthSearch,2) | lookup closures "fullName" AS "fullName" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The following is what doesn't work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval month1='monthSearch1' | eval month2='monthSearch2' | eval month3='monthSearch3' |** fillnull value=0 month1 month2 month3 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Assume $form.quarter$=Q1 and $form.yr$=2015&lt;/P&gt;

&lt;P&gt;The lookup "closures" contains the following info:&lt;/P&gt;

&lt;P&gt;fullname,201507,201508,201509,201510,201511,201512&lt;BR /&gt;
Adam Anderson,12,10,15,,37,11&lt;BR /&gt;
Bob Briggs,,,4,21,,15&lt;BR /&gt;
Cam Carson,10,25,31,22,16,1&lt;/P&gt;

&lt;P&gt;I want an intermediate table that looks like:&lt;/P&gt;

&lt;P&gt;fullName,monthSearch1,monthSearch2,monthSearch3,201507,201508,201509,month1,month2,month3&lt;BR /&gt;
Adam Anderson,201507,201508,201509,12,10,15,12,10,15&lt;/P&gt;</description>
    <pubDate>Tue, 31 Mar 2015 16:37:20 GMT</pubDate>
    <dc:creator>willial</dc:creator>
    <dc:date>2015-03-31T16:37:20Z</dc:date>
    <item>
      <title>Take value from one field and return the value in a second field with the same name as that value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Take-value-from-one-field-and-return-the-value-in-a-second-field/m-p/118744#M31743</link>
      <description>&lt;P&gt;Sorry for the title. Here's what I'm trying to do:&lt;/P&gt;

&lt;P&gt;I have three fields: monthSearch1, monthSearch2, and monthSearch3. These represent a year/month combination. So 201501 = year 2015, month 01.&lt;/P&gt;

&lt;P&gt;These have values of, for example: monthSearch1=201501 monthSearch2=201502 monthSearch3=201503&lt;/P&gt;

&lt;P&gt;I also have three fields called 201501, 201502, 201503. These have numbers in them like 6 or 8 or 12.&lt;/P&gt;

&lt;P&gt;I have even more fields: 201504, 201505, etc. These are all coming from a lookup table. I have things set up so that the monthSearch1,2,3 fields are set by user choices, so I only get the three year/month combos that I want for any user selection.&lt;/P&gt;

&lt;P&gt;Basically, I want to use the monthSearch1 field (201501) to find and return the value that's in the 201501 field (and so on), so that I only add up the correct 3 months.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2015 20:10:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Take-value-from-one-field-and-return-the-value-in-a-second-field/m-p/118744#M31743</guid>
      <dc:creator>willial</dc:creator>
      <dc:date>2015-03-30T20:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Take value from one field and return the value in a second field with the same name as that value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Take-value-from-one-field-and-return-the-value-in-a-second-field/m-p/118745#M31744</link>
      <description>&lt;P&gt;Can you please share the detailed example along with data samples?&lt;/P&gt;

&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2015 11:07:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Take-value-from-one-field-and-return-the-value-in-a-second-field/m-p/118745#M31744</guid>
      <dc:creator>vganjare</dc:creator>
      <dc:date>2015-03-31T11:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: Take value from one field and return the value in a second field with the same name as that value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Take-value-from-one-field-and-return-the-value-in-a-second-field/m-p/118746#M31745</link>
      <description>&lt;P&gt;Here are my statements, starting from the relevant portion:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval yr="$form.yr$" | eval quarter="$form.quarter$" | eval yr=if("$form.quarter$"="Q1" OR "$form.quarter$"="Q2",yr-1,yr) | eval monthSearch=if("$form.quarter$"="Q1",'yr'+"07 "+'yr'+"08 "+'yr'+"09 ",monthSearch) | eval monthSearch=if("$form.quarter$"="Q2",'yr'+"10 "+'yr'+"11 "+'yr'+"12 ",monthSearch) | eval monthSearch=if("$form.quarter$"="Q3",'yr'+"01 "+'yr'+"02 "+'yr'+"03 ",monthSearch) | eval monthSearch=if("$form.quarter$"="Q4",'yr'+"04 "+'yr'+"05 "+'yr'+"06 ",monthSearch) | makemv monthSearch | eval monthSearch1=mvindex(monthSearch,0) | eval monthSearch2=mvindex(monthSearch,1) | eval monthSearch3=mvindex(monthSearch,2) | lookup closures "fullName" AS "fullName" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The following is what doesn't work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval month1='monthSearch1' | eval month2='monthSearch2' | eval month3='monthSearch3' |** fillnull value=0 month1 month2 month3 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Assume $form.quarter$=Q1 and $form.yr$=2015&lt;/P&gt;

&lt;P&gt;The lookup "closures" contains the following info:&lt;/P&gt;

&lt;P&gt;fullname,201507,201508,201509,201510,201511,201512&lt;BR /&gt;
Adam Anderson,12,10,15,,37,11&lt;BR /&gt;
Bob Briggs,,,4,21,,15&lt;BR /&gt;
Cam Carson,10,25,31,22,16,1&lt;/P&gt;

&lt;P&gt;I want an intermediate table that looks like:&lt;/P&gt;

&lt;P&gt;fullName,monthSearch1,monthSearch2,monthSearch3,201507,201508,201509,month1,month2,month3&lt;BR /&gt;
Adam Anderson,201507,201508,201509,12,10,15,12,10,15&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2015 16:37:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Take-value-from-one-field-and-return-the-value-in-a-second-field/m-p/118746#M31745</guid>
      <dc:creator>willial</dc:creator>
      <dc:date>2015-03-31T16:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Take value from one field and return the value in a second field with the same name as that value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Take-value-from-one-field-and-return-the-value-in-a-second-field/m-p/118747#M31746</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Do you want to copy the values from monthSearch1 field to month1 field?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Apr 2015 12:06:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Take-value-from-one-field-and-return-the-value-in-a-second-field/m-p/118747#M31746</guid>
      <dc:creator>vganjare</dc:creator>
      <dc:date>2015-04-27T12:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: Take value from one field and return the value in a second field with the same name as that value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Take-value-from-one-field-and-return-the-value-in-a-second-field/m-p/118748#M31747</link>
      <description>&lt;P&gt;More convoluted. I want to copy the value from the field whose name is specified in monthSearch1 (field 201507 in the example, yielding 12) to month1.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Apr 2015 13:54:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Take-value-from-one-field-and-return-the-value-in-a-second-field/m-p/118748#M31747</guid>
      <dc:creator>willial</dc:creator>
      <dc:date>2015-04-27T13:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: Take value from one field and return the value in a second field with the same name as that value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Take-value-from-one-field-and-return-the-value-in-a-second-field/m-p/118749#M31748</link>
      <description>&lt;P&gt;Can you try using custom search commands? With a small python script, you can achieve this functionality very easily. More details about custom search commands @ &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.2/AdvancedDev/Searchscripts"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.2/AdvancedDev/Searchscripts&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2015 05:36:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Take-value-from-one-field-and-return-the-value-in-a-second-field/m-p/118749#M31748</guid>
      <dc:creator>vganjare</dc:creator>
      <dc:date>2015-04-28T05:36:45Z</dc:date>
    </item>
    <item>
      <title>Re: Take value from one field and return the value in a second field with the same name as that value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Take-value-from-one-field-and-return-the-value-in-a-second-field/m-p/118750#M31749</link>
      <description>&lt;P&gt;Also, can you try solution mentioned @ &lt;A href="http://answers.splunk.com/answers/103700/how-do-i-create-a-field-whose-name-is-the-value-of-another-field-like-backticks-or-eval-in-other-languages.html"&gt;http://answers.splunk.com/answers/103700/how-do-i-create-a-field-whose-name-is-the-value-of-another-field-like-backticks-or-eval-in-other-languages.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2015 06:27:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Take-value-from-one-field-and-return-the-value-in-a-second-field/m-p/118750#M31749</guid>
      <dc:creator>vganjare</dc:creator>
      <dc:date>2015-04-28T06:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: Take value from one field and return the value in a second field with the same name as that value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Take-value-from-one-field-and-return-the-value-in-a-second-field/m-p/118751#M31750</link>
      <description>&lt;P&gt;The solution there is for creating a new field. I'm trying to reference an existing field.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2015 14:00:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Take-value-from-one-field-and-return-the-value-in-a-second-field/m-p/118751#M31750</guid>
      <dc:creator>willial</dc:creator>
      <dc:date>2015-04-28T14:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: Take value from one field and return the value in a second field with the same name as that value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Take-value-from-one-field-and-return-the-value-in-a-second-field/m-p/118752#M31751</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;You can try using custom search command. &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.2/AdvancedDev/Searchscripts"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.2/AdvancedDev/Searchscripts&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;You can copy over the field values in desired field by using string token.&lt;/P&gt;

&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2015 06:36:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Take-value-from-one-field-and-return-the-value-in-a-second-field/m-p/118752#M31751</guid>
      <dc:creator>vganjare</dc:creator>
      <dc:date>2015-04-29T06:36:33Z</dc:date>
    </item>
  </channel>
</rss>

