<?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 Can you please help me in creating a table with multiple rows of the same field using stats or some other code? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493038#M137513</link>
    <description>&lt;P&gt;I need to display multiple rows having the same PART_NUMBER value for each FLIT_COMPONENTS and AMOUNT&lt;/P&gt;

&lt;P&gt;sourcetype=flit_info ------ has PART_NUMBER, PLANT_CODE, PALLET_TYPE, DISPATCH_UNIT , CAPACITY , FLIT_RULE_ID &lt;/P&gt;

&lt;P&gt;sourcetype=flit_comp ----------- has AMOUNT, UPDATED_BY&lt;/P&gt;

&lt;P&gt;both of these sourcetypes have only one common field which is "ID" in sourcetype="flit_info" AND "FLIT_INSTRUCTION_ID" in sourcetype="flit_comp" . I was able to do stats by combining these two fields in a field only.&lt;/P&gt;

&lt;P&gt;Code I have used - &lt;/P&gt;

&lt;P&gt;index=ibldc-db sourcetype="flit_info"  OR sourcetype="flit_comp" &lt;BR /&gt;
| dedup ID&lt;BR /&gt;
| rename FLIT_INSTRUCTION_ID as IDc&lt;BR /&gt;
| eval IDs=coalesce(IDc,ID)&lt;BR /&gt;
| makemv IDs&lt;BR /&gt;
| stats list(PART_NUMBER) as PART_NUMBER list(PLANT_CODE) as PLANT_CODE list(PALLET_TYPE) as PALLET_TYPE list(CAPACITY) as CAPACITY  list(DU) as DISPATCH_UNIT list(BUNDLE_COMPONENT) as FLIT_COMPONENTS  list(AMOUNT) as AMOUNT list(RULE_ID) as FLIT_RULE_ID list(UPDATED_BY) as UPDATED_BY by  IDs&lt;BR /&gt;
| table  PART_NUMBER PLANT_CODE PALLET_TYPE CAPACITY FLIT_COMPONENTS AMOUNT DISPATCH_UNIT FLIT_RULE_ID UPDATED_BY&lt;/P&gt;

&lt;P&gt;Results are like -&lt;BR /&gt;
&lt;IMG src="https://community.splunk.com/storage/temp/279769-capture.jpg" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;What is expected is that the PART_NUMBER should fill all the rows wherever the FLIT_COMPONENTS are present&lt;/P&gt;

&lt;P&gt;mulitple rows  for each FLIT_COMPONENTS , that is the same values of the PART_NUMBER and the rest of the columns should be individual rows so that if we download the report in excel each row will have PART_NUMBER and FLIT_COMPONENTS&lt;/P&gt;

&lt;P&gt;I need your inputs on how to build this query?&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 03:51:11 GMT</pubDate>
    <dc:creator>dinu1701</dc:creator>
    <dc:date>2020-09-30T03:51:11Z</dc:date>
    <item>
      <title>Can you please help me in creating a table with multiple rows of the same field using stats or some other code?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493038#M137513</link>
      <description>&lt;P&gt;I need to display multiple rows having the same PART_NUMBER value for each FLIT_COMPONENTS and AMOUNT&lt;/P&gt;

&lt;P&gt;sourcetype=flit_info ------ has PART_NUMBER, PLANT_CODE, PALLET_TYPE, DISPATCH_UNIT , CAPACITY , FLIT_RULE_ID &lt;/P&gt;

&lt;P&gt;sourcetype=flit_comp ----------- has AMOUNT, UPDATED_BY&lt;/P&gt;

&lt;P&gt;both of these sourcetypes have only one common field which is "ID" in sourcetype="flit_info" AND "FLIT_INSTRUCTION_ID" in sourcetype="flit_comp" . I was able to do stats by combining these two fields in a field only.&lt;/P&gt;

&lt;P&gt;Code I have used - &lt;/P&gt;

&lt;P&gt;index=ibldc-db sourcetype="flit_info"  OR sourcetype="flit_comp" &lt;BR /&gt;
| dedup ID&lt;BR /&gt;
| rename FLIT_INSTRUCTION_ID as IDc&lt;BR /&gt;
| eval IDs=coalesce(IDc,ID)&lt;BR /&gt;
| makemv IDs&lt;BR /&gt;
| stats list(PART_NUMBER) as PART_NUMBER list(PLANT_CODE) as PLANT_CODE list(PALLET_TYPE) as PALLET_TYPE list(CAPACITY) as CAPACITY  list(DU) as DISPATCH_UNIT list(BUNDLE_COMPONENT) as FLIT_COMPONENTS  list(AMOUNT) as AMOUNT list(RULE_ID) as FLIT_RULE_ID list(UPDATED_BY) as UPDATED_BY by  IDs&lt;BR /&gt;
| table  PART_NUMBER PLANT_CODE PALLET_TYPE CAPACITY FLIT_COMPONENTS AMOUNT DISPATCH_UNIT FLIT_RULE_ID UPDATED_BY&lt;/P&gt;

&lt;P&gt;Results are like -&lt;BR /&gt;
&lt;IMG src="https://community.splunk.com/storage/temp/279769-capture.jpg" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;What is expected is that the PART_NUMBER should fill all the rows wherever the FLIT_COMPONENTS are present&lt;/P&gt;

&lt;P&gt;mulitple rows  for each FLIT_COMPONENTS , that is the same values of the PART_NUMBER and the rest of the columns should be individual rows so that if we download the report in excel each row will have PART_NUMBER and FLIT_COMPONENTS&lt;/P&gt;

&lt;P&gt;I need your inputs on how to build this query?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:51:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493038#M137513</guid>
      <dc:creator>dinu1701</dc:creator>
      <dc:date>2020-09-30T03:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: Can you please help me in creating a table with multiple rows of the same field using stats or some other code?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493039#M137514</link>
      <description>&lt;P&gt;@dinu1701 &lt;/P&gt;

&lt;P&gt;Can you please try by adding below search into your search? &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval tmp=mvzip(mvzip(FLIT_COMPONENTS, AMOUNT), UPDATED_BY) 
| mvexpand tmp
| eval FLIT_COMPONENTS=mvindex(split(tmp,","),0), AMOUNT=mvindex(split(tmp,","),1), UPDATED_BY=mvindex(split(tmp,","),2) 
| fields - tmp
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Jan 2020 13:36:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493039#M137514</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2020-01-29T13:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: Can you please help me in creating a table with multiple rows of the same field using stats or some other code?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493040#M137515</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt;  Thanks for your reply&lt;/P&gt;

&lt;P&gt;When I execute this query I get &lt;/P&gt;

&lt;P&gt;The search job has failed due to an error. You may be able view the job in the Job Inspector&lt;/P&gt;

&lt;P&gt;only this I am able to execute - &lt;BR /&gt;
| eval tmp=mvzip(mvzip(FLIT_COMPONENTS, AMOUNT), UPDATED_BY) &lt;/P&gt;

&lt;P&gt;which creates a subset like this - &lt;BR /&gt;
10,20,users&lt;BR /&gt;
30,20,reddu&lt;/P&gt;

&lt;P&gt;I need a subset which attaches to PART_NUMBER because its from a different &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:51:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493040#M137515</guid>
      <dc:creator>dinu1701</dc:creator>
      <dc:date>2020-09-30T03:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: Can you please help me in creating a table with multiple rows of the same field using stats or some other code?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493041#M137516</link>
      <description>&lt;P&gt;@dinu1701&lt;/P&gt;

&lt;P&gt;Ooh,  my bad. silly mistake.  I have updated search. can you please try that?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 14:35:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493041#M137516</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2020-01-29T14:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: Can you please help me in creating a table with multiple rows of the same field using stats or some other code?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493042#M137517</link>
      <description>&lt;P&gt;You are adding an extra component that is not needed if you are wanting to create a table to show PART_NUMBER, FLIT_COMPONENTS and AMOUNT.&lt;/P&gt;

&lt;P&gt;According to Splunk Docs, &lt;CODE&gt;list()&lt;/CODE&gt; returns a list of up to 100 values of the field X as a multivalue entry. That is why you are getting multiple entries FLIT_COMPONENTS and AMOUNT for a specific field PART_NUMBER. &lt;/P&gt;

&lt;P&gt;I recommend using &lt;CODE&gt;rename&lt;/CODE&gt; instead of &lt;CODE&gt;stats list(field) as new_field&lt;/CODE&gt; if you are just changing field names to show in the table. You also have a &lt;CODE&gt;by IDs&lt;/CODE&gt; at the end of your &lt;CODE&gt;stats&lt;/CODE&gt; but then do not keep it in your &lt;CODE&gt;table&lt;/CODE&gt; command.&lt;/P&gt;

&lt;P&gt;I would try to look at this search:&lt;BR /&gt;
**&lt;BR /&gt;
index=ibldc-db sourcetype="flit_info" OR sourcetype="flit_comp"&lt;BR /&gt;
| dedup ID&lt;BR /&gt;
| rename FLIT_INSTRUCTION_ID as IDc, DU as DISPATCH_UNIT, BUNDLE_COMPONENT as FLIT_COMPONENTS, RULE_ID as FLIT_RULE_ID&lt;BR /&gt;
| eval IDs=coalesce(IDc, ID)&lt;BR /&gt;
| makemv IDs&lt;BR /&gt;
| table PART_NUMBER PLANT_CODE PALLET_TYPE CAPACITY FLIT_COMPONENTS AMOUNT DISPATCH_UNIT FLIT_RULE_ID UPDATED_BY&lt;BR /&gt;
**&lt;/P&gt;

&lt;P&gt;in the &lt;CODE&gt;table&lt;/CODE&gt; part you can feel free to add or remove whatever fields you want to show at the end of your search.&lt;/P&gt;

&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:51:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493042#M137517</guid>
      <dc:creator>13tsavage</dc:creator>
      <dc:date>2020-09-30T03:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: Can you please help me in creating a table with multiple rows of the same field using stats or some other code?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493043#M137518</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt; Still I am getting the same table &lt;BR /&gt;
when I do stats all the for one part_number row there are multiple values of FLIT_COMPONENT and AMOUNT.&lt;/P&gt;

&lt;P&gt;Though the code you shared is correct, what I need is multiple rows of PART_NUMBER matching each row of FLIT_COMPONENT&lt;/P&gt;

&lt;P&gt;Expected -&lt;/P&gt;

&lt;P&gt;PART_NUMBER                      |                   FLIT_COMPONENT                           |           AMOUNT&lt;BR /&gt;
XXXXXXXX                               |                          17                                                  |               1&lt;BR /&gt;
XXXXXXXX                                |                           18                                                 |                2&lt;/P&gt;

&lt;P&gt;Observed result - &lt;BR /&gt;
PART_NUMBER                      |                   FLIT_COMPONENT                           |           AMOUNT&lt;BR /&gt;
XXXXXXXX                               |                          17                                                  |               1&lt;BR /&gt;
                                                  |                           18                                               |                2&lt;/P&gt;

&lt;P&gt;one row of PART_NUMBER is combined in the same row with multiple amounts for FLIT_COMPONENT and AMOUNT&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:09:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493043#M137518</guid>
      <dc:creator>dinu1701</dc:creator>
      <dc:date>2020-09-30T04:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Can you please help me in creating a table with multiple rows of the same field using stats or some other code?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493044#M137519</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/162334"&gt;@13tsavage&lt;/a&gt;  .&lt;BR /&gt;
Still I am getting the same table &lt;BR /&gt;
when I do stats all the for one part_number row there are multiple values of FLIT_COMPONENT and AMOUNT.&lt;/P&gt;

&lt;P&gt;Though the code you shared is correct, what I need is multiple rows of PART_NUMBER matching each row of FLIT_COMPONENT&lt;/P&gt;

&lt;P&gt;Expected -&lt;/P&gt;

&lt;P&gt;PART_NUMBER                      |                   FLIT_COMPONENT                           |           AMOUNT&lt;BR /&gt;
XXXXXXXX                               |                          17                                                  |               1&lt;BR /&gt;
XXXXXXXX                                |                           18                                                 |                2&lt;/P&gt;

&lt;P&gt;Observed result - &lt;BR /&gt;
PART_NUMBER                      |                   FLIT_COMPONENT                           |           AMOUNT&lt;BR /&gt;
XXXXXXXX                               |                          17                                                  |               1&lt;BR /&gt;
                                                  |                           18                                               |                2&lt;/P&gt;

&lt;P&gt;one row of PART_NUMBER is combined in the same row with multiple amounts for FLIT_COMPONENT and AMOUNT.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:09:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493044#M137519</guid>
      <dc:creator>dinu1701</dc:creator>
      <dc:date>2020-09-30T04:09:13Z</dc:date>
    </item>
    <item>
      <title>Re: Can you please help me in creating a table with multiple rows of the same field using stats or some other code?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493045#M137520</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| stats list(PART_NUMBER) as PART_NUMBER list(PLANT_CODE) as PLANT_CODE list(PALLET_TYPE) as PALLET_TYPE list(CAPACITY) as CAPACITY list(DU) as DISPATCH_UNIT list(BUNDLE_COMPONENT) as FLIT_COMPONENTS list(AMOUNT) as AMOUNT list(RULE_ID) as FLIT_RULE_ID values(UPDATED_BY) as UPDATED_BY by IDs
| eval tmp=mvzip(FLIT_COMPONENTS,AMOUNT)
| fields - FLIT_COMPONENTS,AMOUNT
| mvexpand tmp
| eval FLIT_COMPONENTS=mvindex(split(tmp,","),0) ,AMOUNT=mvindex(split(tmp,","),1)
| table PART_NUMBER PLANT_CODE PALLET_TYPE CAPACITY FLIT_COMPONENTS AMOUNT DISPATCH_UNIT FLIT_RULE_ID UPDATED_BY
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval IDs=coalesce(IDc,ID)
| makemv IDs
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What Is &lt;EM&gt;IDs&lt;/EM&gt;  ? &lt;BR /&gt;
&lt;CODE&gt;mekamv&lt;/CODE&gt; splits by space.  so, "XXXXX XXXX"?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 13:31:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493045#M137520</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-10T13:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: Can you please help me in creating a table with multiple rows of the same field using stats or some other code?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493046#M137521</link>
      <description>&lt;P&gt;I never had stats in my search, so I am not sure how you are getting the same table. &lt;/P&gt;

&lt;P&gt;What you are looking for then is&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;index=ibldc-db sourcetype="flit_info" OR sourcetype="flit_comp"&lt;BR /&gt;
| dedup ID&lt;BR /&gt;
| rename FLIT_INSTRUCTION_ID as IDc, DU as DISPATCH_UNIT, BUNDLE_COMPONENT as FLIT_COMPONENTS, RULE_ID as FLIT_RULE_ID&lt;BR /&gt;
| eval IDs=coalesce(IDc, ID)&lt;BR /&gt;
| makemv IDs&lt;BR /&gt;
| table PART_NUMBER, FLIT_COMPONENTS, AMOUNT&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Feel free to add whatever fields after &lt;CODE&gt;table&lt;/CODE&gt; as you would like. Especially if you want the IDs field in the table or not.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:04:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493046#M137521</guid>
      <dc:creator>13tsavage</dc:creator>
      <dc:date>2020-09-30T04:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: Can you please help me in creating a table with multiple rows of the same field using stats or some other code?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493047#M137522</link>
      <description>&lt;P&gt;If the table you are wanting to present at the end does not have all the fields then you do not need to add the &lt;CODE&gt;eval IDs&lt;/CODE&gt;, &lt;CODE&gt;makemv IDs&lt;/CODE&gt; or &lt;CODE&gt;dedup ID&lt;/CODE&gt; because that is just extra work for your search. The question to ask is what exactly you want as your result, then tailor your search to fit your results. &lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 15:24:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-please-help-me-in-creating-a-table-with-multiple-rows-of/m-p/493047#M137522</guid>
      <dc:creator>13tsavage</dc:creator>
      <dc:date>2020-02-10T15:24:21Z</dc:date>
    </item>
  </channel>
</rss>

