<?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: Use a sub-search result as table fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-a-sub-search-result-as-table-fields/m-p/607350#M211164</link>
    <description>&lt;P&gt;Sorry, I missed a line&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="main" sourcetype="XmlWinEventLog" tag="authentication"
| table [
   | datamodel "Authentication" 
   | spath output=foo path=objects{}
   | spath input=foo output=calc_field path=calculations{}.outputFields{}.displayName
   | spath input=foo output=field path=fields{}.displayName
   | eval query = mvappend(calc_field , field)
   | fields query
   | mvexpand query
   | format   "" "" "" "" "" ""
]&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 28 Jul 2022 11:16:35 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2022-07-28T11:16:35Z</dc:date>
    <item>
      <title>How to use a sub-search result as table fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-a-sub-search-result-as-table-fields/m-p/607330#M211154</link>
      <description>&lt;P&gt;I am trying to use a search to find fields that I want to use in another search as a table field.&lt;/P&gt;
&lt;P&gt;The first search should return all fields that are used in a datamodel. This looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| datamodel "Authentication" 
| spath output=foo path=objects{}
| spath input=foo output=calc_field path=calculations{}.outputFields{}.displayName
| spath input=foo output=field path=fields{}.displayName
| eval fields = mvappend(calc_field , field)
| mvexpand fields
| table fields&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Then I want to use the list of fields in the table command. I do this for the reason to be able to check the coverage of the CIM fields in the search. Unfortunately, so far without success, so I am grateful for all ideas and any kind of input.&lt;/P&gt;
&lt;P&gt;My first guess was something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index="main" sourcetype="XmlWinEventLog" tag="authentication"
| table [
   | datamodel "Authentication" 
   | spath output=foo path=objects{}
   | spath input=foo output=calc_field path=calculations{}.outputFields{}.displayName
   | spath input=foo output=field path=fields{}.displayName
   | eval fields = mvappend(calc_field , field)
   | mvexpand fields
   | format   "" "" "," "" "" ""
   | rex mode=sed field=search "s/fields=//g"
   | rename search as table
]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 15:07:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-a-sub-search-result-as-table-fields/m-p/607330#M211154</guid>
      <dc:creator>nextpart</dc:creator>
      <dc:date>2022-07-28T15:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: Use a sub-search result as table fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-a-sub-search-result-as-table-fields/m-p/607340#M211161</link>
      <description>&lt;P&gt;Try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="main" sourcetype="XmlWinEventLog" tag="authentication"
| table [
   | datamodel "Authentication" 
   | spath output=foo path=objects{}
   | spath input=foo output=calc_field path=calculations{}.outputFields{}.displayName
   | spath input=foo output=field path=fields{}.displayName
   | eval query = mvappend(calc_field , field)
   | mvexpand query
   | format   "" "" "" "" "" ""
]&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 28 Jul 2022 10:50:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-a-sub-search-result-as-table-fields/m-p/607340#M211161</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-07-28T10:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: Use a sub-search result as table fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-a-sub-search-result-as-table-fields/m-p/607348#M211163</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;, thanks for your reply. I already tried that one but get the following error:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Error in 'table' command: Invalid argument: 'calc_field=action'&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 28 Jul 2022 11:07:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-a-sub-search-result-as-table-fields/m-p/607348#M211163</guid>
      <dc:creator>nextpart</dc:creator>
      <dc:date>2022-07-28T11:07:32Z</dc:date>
    </item>
    <item>
      <title>Re: Use a sub-search result as table fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-a-sub-search-result-as-table-fields/m-p/607350#M211164</link>
      <description>&lt;P&gt;Sorry, I missed a line&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="main" sourcetype="XmlWinEventLog" tag="authentication"
| table [
   | datamodel "Authentication" 
   | spath output=foo path=objects{}
   | spath input=foo output=calc_field path=calculations{}.outputFields{}.displayName
   | spath input=foo output=field path=fields{}.displayName
   | eval query = mvappend(calc_field , field)
   | fields query
   | mvexpand query
   | format   "" "" "" "" "" ""
]&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 28 Jul 2022 11:16:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-a-sub-search-result-as-table-fields/m-p/607350#M211164</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-07-28T11:16:35Z</dc:date>
    </item>
  </channel>
</rss>

