<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Combine values of array by same two columns data</title><link>https://community.appian.com/discussions/f/rules/30116/combine-values-of-array-by-same-two-columns-data</link><description>Hi all 
 I need one suggestion please let me know if anyone have an idea 
 Question: I had data in array ex: 
 a!map{ 
 (id:1,idTwo:1,value:text), 
 (id:1,idTwo:2,value:exam), 
 (id:1,idTwo:1,value:yes) 
 }, 
 I need to combine the value when id and idTwo</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Combine values of array by same two columns data</title><link>https://community.appian.com/thread/119735?ContentTypeID=1</link><pubDate>Mon, 25 Sep 2023 06:49:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:147968c3-e8b3-4376-b699-d7da6b099bd3</guid><dc:creator>lavanya03</dc:creator><description>&lt;p&gt;Yes I did thanks for suggestion&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Combine values of array by same two columns data</title><link>https://community.appian.com/thread/119734?ContentTypeID=1</link><pubDate>Mon, 25 Sep 2023 06:28:11 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:91430a15-b0b7-4574-8e7b-9a78faf44d79</guid><dc:creator>Harsha Sharma</dc:creator><description>&lt;p&gt;If an answer works, it help to mark it as the Answer so as to help other users refer that in case they are stuck with same issue.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Combine values of array by same two columns data</title><link>https://community.appian.com/thread/119728?ContentTypeID=1</link><pubDate>Mon, 25 Sep 2023 05:05:43 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:034658ce-a090-4c5c-ba00-d7b42bd6a1eb</guid><dc:creator>lavanya03</dc:creator><description>&lt;p&gt;Thanks, It works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Combine values of array by same two columns data</title><link>https://community.appian.com/thread/119722?ContentTypeID=1</link><pubDate>Mon, 25 Sep 2023 00:06:15 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fcf77e82-8156-4f94-bab5-57942b6108f3</guid><dc:creator>Mathieu Drouin</dc:creator><description>&lt;p&gt;Hope this helps:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!array: {
    a!map(id: 1, idTwo: 1, value: &amp;quot;text&amp;quot;),
    a!map(id: 1, idTwo: 2, value: &amp;quot;exam&amp;quot;),
    a!map(id: 1, idTwo: 1, value: &amp;quot;yes&amp;quot;)
  },
  local!separator: &amp;quot;_&amp;quot;,
  local!arrayWithCompositeKey: a!forEach(
    items: local!array,
    expression: a!update(
      fv!item,
      &amp;quot;compositeKey&amp;quot;,
      concat(
        fv!item.id,
        local!separator,
        fv!item.idTwo
      )
    )
  ),
  local!uniqueKeys: union(
    local!arrayWithCompositeKey.compositeKey,
    local!arrayWithCompositeKey.compositeKey
  ),
  a!forEach(
    items: local!uniqueKeys,
    expression: a!localVariables(
      local!ids: split(fv!item, local!separator),
      local!values: index(
        local!arrayWithCompositeKey,
        wherecontains(
          fv!item,
          index(local!arrayWithCompositeKey, &amp;quot;compositeKey&amp;quot;, {})
        )
      ),
      a!map(
        id: tointeger(local!ids[1]),
        idTwo: tointeger(local!ids[2]),
        value: concat(local!values.value)
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>