<?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>how to merge two arrays excluding null values</title><link>https://community.appian.com/discussions/f/new-to-appian/37250/how-to-merge-two-arrays-excluding-null-values</link><description>hi, 
 I have two arrays,{&amp;quot;&amp;quot;,&amp;quot;1&amp;quot;} and {&amp;quot;2&amp;quot;,&amp;quot;3&amp;quot;} 
 I want to merge them, but exclude null and have something like this 
 {&amp;quot;1&amp;quot;,&amp;quot;2&amp;quot;,&amp;quot;3}. 
 
 Any help is appreciated</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: how to merge two arrays excluding null values</title><link>https://community.appian.com/thread/139354?ContentTypeID=1</link><pubDate>Fri, 09 Aug 2024 07:12:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fd38137a-85d5-459b-aba4-9b58684e69eb</guid><dc:creator>Prasanta Paul</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
local!a: { &amp;quot;&amp;quot;, &amp;quot;1&amp;quot; },
local!b: { &amp;quot;2&amp;quot;, &amp;quot;3&amp;quot; },
a!forEach(
items:{local!a,local!b},
expression: if(isnull(fv!item),{}, fv!item)
)
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to merge two arrays excluding null values</title><link>https://community.appian.com/thread/139325?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2024 19:00:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3212bf7b-dc6e-410d-a610-6fe40074e590</guid><dc:creator>kowsalyavijayan</dc:creator><description>&lt;p&gt;tried this, it worked, thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to merge two arrays excluding null values</title><link>https://community.appian.com/thread/139324?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2024 18:33:29 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:79b6a6c5-2815-4709-aed3-05bf8b1cf873</guid><dc:creator>kowsalyavijayan</dc:creator><description>&lt;p&gt;I will try this&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to merge two arrays excluding null values</title><link>https://community.appian.com/thread/139317?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2024 17:00:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a93c6a57-c552-4ed6-b686-10e556195e76</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;For an implementation that avoids the old and clunky primitive looping functions like &lt;em&gt;filter()&lt;/em&gt;, we can use &lt;em&gt;&lt;strong&gt;a!forEach()&lt;/strong&gt;&lt;/em&gt; in this (and almost all other) use cases:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(
  local!array1: {&amp;quot;&amp;quot;, &amp;quot;1&amp;quot;},
  local!array2: {&amp;quot;2&amp;quot;, &amp;quot;3&amp;quot;},

  a!flatten(
    a!forEach(
      union(local!array1, local!array2),
      if(
        a!isNotNullOrEmpty(fv!item),
        fv!item,
        {}
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/62/pastedimage1723136440918v1.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to merge two arrays excluding null values</title><link>https://community.appian.com/thread/139316?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2024 16:52:15 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:10593ea8-2311-416d-af42-a9affe36eab9</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Just give it a try ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to merge two arrays excluding null values</title><link>https://community.appian.com/thread/139314?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2024 16:16:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:937b30f5-780a-4afc-8bde-88f746d4c078</guid><dc:creator>kowsalyavijayan</dc:creator><description>&lt;p&gt;just curious to know, what does this return if both arrays does not have null values&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to merge two arrays excluding null values</title><link>https://community.appian.com/thread/139308?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2024 15:49:11 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:56868588-369c-412f-85b0-afd685bb29fd</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;filter(a!isNotNullOrEmpty(_), union({&amp;quot;&amp;quot;,&amp;quot;1&amp;quot;}, {&amp;quot;2&amp;quot;,&amp;quot;3&amp;quot;}))&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>