<?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>Reject Function</title><link>https://community.appian.com/discussions/f/rules/28395/reject-function</link><description>Hi, 
 Im new to using reject function. 
 Now im using the reject function in a process model in a script task 
 In the input : I am calculating a map which looks like this : 
 { 
 id : &amp;lt;&amp;gt;, 
 account : &amp;lt;account_cdt(id, name, hold_code)&amp;gt; 
 } 
 
 Now in</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Reject Function</title><link>https://community.appian.com/thread/111103?ContentTypeID=1</link><pubDate>Sun, 16 Apr 2023 17:12:08 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:abf8329f-e7c5-4084-9445-e22358ea3c8d</guid><dc:creator>GautamShenoy</dc:creator><description>&lt;p&gt;Thank you so much &lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f60a.svg" title="Blush"&gt;&amp;#x1f60a;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reject Function</title><link>https://community.appian.com/thread/111102?ContentTypeID=1</link><pubDate>Sun, 16 Apr 2023 17:05:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f39c84c8-c8f7-4c53-bdc6-e043d9d355d9</guid><dc:creator>sanchitg0002</dc:creator><description>&lt;p&gt;Then, just make a slight change in the code.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!map: {
    a!map(
      id: 1,
      account: &amp;#39;type!{urn:com:appian:types:PA}PA_accountTemp&amp;#39;(id: 1, name: &amp;quot;test&amp;quot;, holdCode: &amp;quot;&amp;quot;)
    ),
    a!map(
      id: 2,
      account: &amp;#39;type!{urn:com:appian:types:PA}PA_accountTemp&amp;#39;(id: 1, name: &amp;quot;test1&amp;quot;, holdCode: &amp;quot;abcd&amp;quot;)
    ),
    a!map(
      id: 3,
      account: &amp;#39;type!{urn:com:appian:types:PA}PA_accountTemp&amp;#39;(id: 1, name: &amp;quot;test2&amp;quot;, holdCode: &amp;quot;&amp;quot;)
    )
  },
  reject(
    isnull(_),
    a!forEach(
      items: local!map,
      expression: if(
        isnull(
          index(fv!item, &amp;quot;account&amp;quot;, &amp;quot;holdCode&amp;quot;, null)
        ),
        null,
        fv!item
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;edit: Even simpler&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!map: {
    a!map(
      id: 1,
      account: &amp;#39;type!{urn:com:appian:types:PA}PA_accountTemp&amp;#39;(id: 1, name: &amp;quot;test&amp;quot;, holdCode: &amp;quot;&amp;quot;)
    ),
    a!map(
      id: 2,
      account: &amp;#39;type!{urn:com:appian:types:PA}PA_accountTemp&amp;#39;(id: 1, name: &amp;quot;test1&amp;quot;, holdCode: &amp;quot;abcd&amp;quot;)
    ),
    a!map(
      id: 3,
      account: &amp;#39;type!{urn:com:appian:types:PA}PA_accountTemp&amp;#39;(id: 1, name: &amp;quot;test2&amp;quot;, holdCode: &amp;quot;&amp;quot;)
    )
  },
  remove(
    local!map,
    wherecontains(null, local!map.account.holdCode)
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reject Function</title><link>https://community.appian.com/thread/111100?ContentTypeID=1</link><pubDate>Sun, 16 Apr 2023 17:01:54 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:af233793-3bbc-466f-9093-00cedab04c6d</guid><dc:creator>GautamShenoy</dc:creator><description>&lt;p&gt;Sorry I framed the question wrong maybe ... I want the entire map to persist whose account have a hold code ... The other maps should be ignored .... Thanks for correcting and sorry for the error &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reject Function</title><link>https://community.appian.com/thread/111099?ContentTypeID=1</link><pubDate>Sun, 16 Apr 2023 16:59:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0bcf92cc-c9b7-4a15-b0fa-9e683d803c00</guid><dc:creator>sanchitg0002</dc:creator><description>[quote userid="169852" url="~/discussions/f/rules/28395/reject-function"]but then my requirement is that the ID should remain in the output[/quote]
&lt;p&gt;Then what about this that you have mentioned above in the description?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reject Function</title><link>https://community.appian.com/thread/111098?ContentTypeID=1</link><pubDate>Sun, 16 Apr 2023 16:57:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:38c8359a-5fd5-47f7-9a8e-43a19e1e2814</guid><dc:creator>GautamShenoy</dc:creator><description>&lt;p&gt;Thanks for the solution&lt;/p&gt;
&lt;p&gt;But the purpose was not to remove the hold code ... The purpose was to just retain the map who actually has a hold code and ignore the ones that doesn&amp;#39;t &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reject Function</title><link>https://community.appian.com/thread/111097?ContentTypeID=1</link><pubDate>Sun, 16 Apr 2023 16:41:50 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e2089456-2773-43d3-a417-c4b592729249</guid><dc:creator>sanchitg0002</dc:creator><description>&lt;p&gt;I don&amp;#39;t understand the purpose of removing holdCode from the cdt if it is null and only show the account id in that case.&lt;/p&gt;
&lt;p&gt;But if I can understand the requirement correctly then you will be wanting to implement it as follows:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!map: {
    a!map(
      id: 1,
      account: &amp;#39;type!{urn:com:appian:types:PA}PA_accountTemp&amp;#39;(id: 1, name: &amp;quot;test&amp;quot;, holdCode: &amp;quot;&amp;quot;)
    ),
    a!map(
      id: 2,
      account: &amp;#39;type!{urn:com:appian:types:PA}PA_accountTemp&amp;#39;(id: 1, name: &amp;quot;test1&amp;quot;, holdCode: &amp;quot;abcd&amp;quot;)
    ),
    a!map(
      id: 3,
      account: &amp;#39;type!{urn:com:appian:types:PA}PA_accountTemp&amp;#39;(id: 1, name: &amp;quot;test2&amp;quot;, holdCode: &amp;quot;&amp;quot;)
    )
  },
  a!forEach(
    items: local!map,
    expression: if(
      isnull(
        index(fv!item, &amp;quot;account&amp;quot;, &amp;quot;holdCode&amp;quot;, null)
      ),
      updatedictionary(
        fv!item,
        { account: { id: fv!item.account.id } }
      ),
      fv!item
    )
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " height="102" src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/15/pastedimage1681663356984v1.png" width="83" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>