<?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: Apply transformers directly on variables in Cortex XSOAR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/apply-transformers-directly-on-variables/m-p/540250#M2053</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/226640"&gt;@Josep&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The simple answer to your question is yes, you can use transformer to write for loop to get each ${datainput} value but it's not quite simple. You will need to utilize DT (General) and to write JavaScript for loop code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the task, Get = ${dataInput} assuming this is a simple list with different items instead of a Json object.&lt;/P&gt;
&lt;P&gt;For the Transformer, here is what you would enter:&lt;/P&gt;
&lt;P&gt;.=&amp;gt;val.map(function(elem){&lt;/P&gt;
&lt;P&gt;my_str="subkey";&lt;/P&gt;
&lt;P&gt;tags=elem{'dataInput};&lt;/P&gt;
&lt;P&gt;tagnames="";&lt;/P&gt;
&lt;P&gt;for(i=0;i&amp;lt;tags.length;i++){&lt;/P&gt;
&lt;P&gt;my_str=my_str+i=","&lt;/P&gt;
&lt;P&gt;tagnames=tagnames+tags[i]+",";}&lt;/P&gt;
&lt;P&gt;return {my_str.slice(0,-1):tagnames.slice(0,-1)}})&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obviously, I cannot guarantee that this DT will work for your incident since there are a few variables that I would need to know and this will require testing in your instance. I would suggest to play around with DT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck!&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Yuki&lt;/P&gt;</description>
    <pubDate>Wed, 26 Apr 2023 20:47:37 GMT</pubDate>
    <dc:creator>yuki_sato</dc:creator>
    <dc:date>2023-04-26T20:47:37Z</dc:date>
    <item>
      <title>Apply transformers directly on variables</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/apply-transformers-directly-on-variables/m-p/528505#M1714</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I'm creating Json lists introducing data in them. I'm using "addToList" automation. The data introduced example:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;listData:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;{"key1":{&lt;/P&gt;
&lt;P&gt;"subkey1: ${dataInput1},&lt;/P&gt;
&lt;P&gt;"subkey2: ${dataInput2},&lt;/P&gt;
&lt;P&gt;"subkey3: ${dataInput3},&lt;/P&gt;
&lt;P&gt;"subkey4: ${dataInput4}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to transform the variables directly in the input &lt;STRONG&gt;listData&lt;/STRONG&gt; with no need to create a set for each dataInput?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2023 09:49:00 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/apply-transformers-directly-on-variables/m-p/528505#M1714</guid>
      <dc:creator>Josep</dc:creator>
      <dc:date>2023-01-25T09:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Apply transformers directly on variables</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/apply-transformers-directly-on-variables/m-p/540250#M2053</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/226640"&gt;@Josep&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The simple answer to your question is yes, you can use transformer to write for loop to get each ${datainput} value but it's not quite simple. You will need to utilize DT (General) and to write JavaScript for loop code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the task, Get = ${dataInput} assuming this is a simple list with different items instead of a Json object.&lt;/P&gt;
&lt;P&gt;For the Transformer, here is what you would enter:&lt;/P&gt;
&lt;P&gt;.=&amp;gt;val.map(function(elem){&lt;/P&gt;
&lt;P&gt;my_str="subkey";&lt;/P&gt;
&lt;P&gt;tags=elem{'dataInput};&lt;/P&gt;
&lt;P&gt;tagnames="";&lt;/P&gt;
&lt;P&gt;for(i=0;i&amp;lt;tags.length;i++){&lt;/P&gt;
&lt;P&gt;my_str=my_str+i=","&lt;/P&gt;
&lt;P&gt;tagnames=tagnames+tags[i]+",";}&lt;/P&gt;
&lt;P&gt;return {my_str.slice(0,-1):tagnames.slice(0,-1)}})&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obviously, I cannot guarantee that this DT will work for your incident since there are a few variables that I would need to know and this will require testing in your instance. I would suggest to play around with DT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck!&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Yuki&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 20:47:37 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/apply-transformers-directly-on-variables/m-p/540250#M2053</guid>
      <dc:creator>yuki_sato</dc:creator>
      <dc:date>2023-04-26T20:47:37Z</dc:date>
    </item>
  </channel>
</rss>

