<?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>Parallel evaluation</title><link>https://community.appian.com/discussions/f/general/39607/parallel-evaluation</link><description>I am running some processing in parallel that includes api calls.The result with then populate an interface attended by a user. 
 I have tried both a!forEach and MNI but for both the performance is not as expected. 
 By looking at the performance tab</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Parallel evaluation</title><link>https://community.appian.com/thread/150953?ContentTypeID=1</link><pubDate>Thu, 14 Aug 2025 14:54:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e876c241-d22e-4965-a744-06c94ba8e6b5</guid><dc:creator>Shubham Aware</dc:creator><description>&lt;p&gt;You&amp;rsquo;re right - &amp;nbsp;In this case parallel gateways won&amp;rsquo;t work because you&amp;rsquo;d need to pre-design 70 paths with bounds checking and it breaks result chaining. Your multiple if statement approach is better for this case.​​​​​​​​​​​​​​​​&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Parallel evaluation</title><link>https://community.appian.com/thread/150950?ContentTypeID=1</link><pubDate>Thu, 14 Aug 2025 14:15:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6d8d59aa-dfde-402c-bff8-781d6d89f1f5</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;&amp;nbsp;&lt;a href="/members/peter.lewis"&gt;Peter Lewis&lt;/a&gt;&amp;nbsp;, can you help us to better understand how to decouple looping code aiding in automatic parallel execution?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Parallel evaluation</title><link>https://community.appian.com/thread/150948?ContentTypeID=1</link><pubDate>Thu, 14 Aug 2025 14:12:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:41bb0390-fb1f-477a-bbf3-d7776fd6ea77</guid><dc:creator>davidea</dc:creator><description>&lt;p&gt;Yes, I can run all the apis in this critical part in an expression rule. The input to the rule is an array, Each item can run in parallel. For each item in the array,&amp;nbsp;1,2 or 3 different threads can be spawned, these need to run sequentially. Each of these sub threads run 2 or 3 apis. All of this is handled pretty much, an api call is made only&amp;nbsp;when necessary.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Parallel evaluation</title><link>https://community.appian.com/thread/150946?ContentTypeID=1</link><pubDate>Thu, 14 Aug 2025 13:59:03 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b4189475-334b-4e65-a164-90b6acdc0aa4</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Are any of your API calls possible to run in an expression rule?&amp;nbsp; It sounds like (but i can&amp;#39;t tell exactly because you haven&amp;#39;t included too much context / screenshots / etc) you&amp;#39;re running multiple subsequent / branching / looping calls that could potentially be run sequentially with grouping and conditionality (for increased efficiency) within one or more expression rules...&lt;/p&gt;
&lt;p&gt;For instance, one call that determines whether some subsequent ones even need to be run, instead of being put in multiple process nodes, could potentially be loaded as local variables in a single expression rule, which could potentially simplify your process structure by quite a bit, and at least decrease your chaining burden, even if the total time consumed for the actual calls to run stays about the same.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Parallel evaluation</title><link>https://community.appian.com/thread/150944?ContentTypeID=1</link><pubDate>Thu, 14 Aug 2025 13:52:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ce078c52-020c-4169-9cf2-2d48c287a829</guid><dc:creator>davidea</dc:creator><description>&lt;p&gt;Thank you Shubham,&lt;/p&gt;
&lt;p&gt;I have not tried that yet. The problems I have with that approach though is that:&lt;/p&gt;
&lt;p&gt;1) I do not know beforehand exactly how many items are in the initial array (could be 20, could be 70). I think this would mean designing 70 parallel processes and have them test whether there is an occurrence in the array that matches that?&lt;/p&gt;
&lt;p&gt;2) That would definitely break chaining, I would like to preserve it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Parallel evaluation</title><link>https://community.appian.com/thread/150942?ContentTypeID=1</link><pubDate>Thu, 14 Aug 2025 13:25:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:693af7f5-b3d6-4503-9af6-3aa63f6bc73f</guid><dc:creator>Shubham Aware</dc:creator><description>&lt;p&gt;It looks like you mostly tried various approaches, but my recommendation is,&lt;br /&gt;Parallel gateways with subprocess nodes means using a process model where an AND gateway splits the process flow into multiple parallel paths, each containing a subprocess node that calls a separate process model to handle one API call. All subprocess nodes execute concurrently, then an AND gateway converges the paths back together when all subprocesses complete.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Parallel evaluation</title><link>https://community.appian.com/thread/150941?ContentTypeID=1</link><pubDate>Thu, 14 Aug 2025 13:21:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f1ee8630-fd04-40dc-bdff-2041b38c2f63</guid><dc:creator>davidea</dc:creator><description>&lt;p&gt;Yes, it appears to state that a!foreach should do the trick but I have evidence to refute it.&lt;/p&gt;
&lt;p&gt;I can set an upper limit just below 100 items, while it looks ugly it works and whatever wizardry Appian is doing behind the scenes I will not be able to change it. There are probably nicer ways to &amp;quot;convince&amp;quot; the Appian engine but I cannot keep experimenting forever due to deadlines.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Parallel evaluation</title><link>https://community.appian.com/thread/150933?ContentTypeID=1</link><pubDate>Thu, 14 Aug 2025 10:39:03 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f78d7e8f-03ce-4751-b43d-be154023f0dd</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;I hope your list does not have more than a billion items ;-)&lt;/p&gt;
&lt;p&gt;Did you read this?&lt;/p&gt;
&lt;p&gt;&lt;a id="" href="https://docs.appian.com/suite/help/25.2/expressions-parallel-evaluation.html"&gt;https://docs.appian.com/suite/help/25.2/expressions-parallel-evaluation.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Parallel evaluation</title><link>https://community.appian.com/thread/150932?ContentTypeID=1</link><pubDate>Thu, 14 Aug 2025 08:45:02 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:13b2d3b1-97ba-4813-9d67-29cff3a0b399</guid><dc:creator>davidea</dc:creator><description>&lt;p&gt;Thank you Mike, we have used such a solution in the past but here it would not have sufficed as the waiting time was too long at least in some scenarios. Looks like I stumbled on a solution though as per answer above&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Parallel evaluation</title><link>https://community.appian.com/thread/150931?ContentTypeID=1</link><pubDate>Thu, 14 Aug 2025 08:35:12 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:69775f14-ac1a-459e-a6d2-560d52bbd8f5</guid><dc:creator>davidea</dc:creator><description>&lt;p&gt;I somehow stumbled on a solution.&lt;/p&gt;
&lt;p&gt;The original code was:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!forEach(
  items: ri!ofscSlots,
  expression: rule!FF_processOFSCSlotsBridge(
    ofscSlot: fv!item,
    activityType: ri!activityType,
    postcode: ri!postcode,
    duration: ri!duration,
    products: ri!products
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Bizarrely the (ugly) code below trigger the parallel evaluation&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!numberSlots: length( ri!ofscSlots),
  {
    if(1&amp;lt;=local!numberSlots,
       rule!FF_processOFSCSlotsBridge(
         ofscSlot: ri!ofscSlots[1],
         activityType: ri!activityType,
         postcode: ri!postcode,
         duration: ri!duration,
         products: ri!products
       ),
       {}
       ),
       if(2&amp;lt;=local!numberSlots,
       rule!FF_processOFSCSlotsBridge(
         ofscSlot: ri!ofscSlots[2],
         activityType: ri!activityType,
         postcode: ri!postcode,
         duration: ri!duration,
         products: ri!products
       ),
       {}
       ),
      ---- And so on ------  &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The expression rule has multiple api calls and some relatively simple data transformation.&lt;/p&gt;
&lt;p&gt;Really strange&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Parallel evaluation</title><link>https://community.appian.com/thread/150925?ContentTypeID=1</link><pubDate>Wed, 13 Aug 2025 15:03:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:65f0edde-a400-4128-bca9-f71721c83052</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Pretty sure with the a!forEach() function, it is an expectation that iterations run sequentially.&amp;nbsp; For MNI, you would only expect parallel processing when specifying the correct node options, i.e. &amp;quot;launch all at once&amp;quot;.&amp;nbsp; If you&amp;#39;re trying to chain across this, though, I would use caution as at best your users will experience pretty severe lag, and at worst, you&amp;#39;ll hit the chaining limit due to internal node counts and the user will be dumped back to the site they were working on.&amp;nbsp; I can only guess at your particular implemention aims, however.&lt;/p&gt;
&lt;p&gt;If the aim is to create a seamless user experience across 2 tasks (one of which falls after the API calls / etc), as always my best suggestion is to design an intermediary task with a &amp;quot;refresh&amp;quot; button which checks for the value of an arbitrary PV you set to an arbitrary &amp;quot;complete&amp;quot; value after the separate thread is complete.&amp;nbsp; This way you can stage the thread in your process in such a way that best allows for performance and processing, rather than trying to squeeze it into such a configuration that allows user chaining across it.&amp;nbsp; I&amp;#39;ve done this here and there and honestly, the users don&amp;#39;t mind waiting around for a few extra moments, especially when they&amp;#39;re given a button they can spam-click with no negative consequences.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Parallel evaluation</title><link>https://community.appian.com/thread/150924?ContentTypeID=1</link><pubDate>Wed, 13 Aug 2025 15:02:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ffa4f245-9cb0-45c5-8045-9e39fb5f1608</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Can you share the code of your expression?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Parallel evaluation</title><link>https://community.appian.com/thread/150917?ContentTypeID=1</link><pubDate>Wed, 13 Aug 2025 09:17:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0f4ed962-e4c5-4aad-b7d1-7443b33826e9</guid><dc:creator>davidea</dc:creator><description>&lt;p&gt;The problem is that I do not know how many paths I need, the content of the array depends of a previous api call.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Parallel evaluation</title><link>https://community.appian.com/thread/150916?ContentTypeID=1</link><pubDate>Wed, 13 Aug 2025 09:05:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f96d5ead-2659-4ab7-bc7a-766e8c893694</guid><dc:creator>Harsha Sharma</dc:creator><description>&lt;p&gt;If foreach and MNI both are not helping, you can creating process model using parallel paths for each api call - basically call each api call independent of each other using AND node and a separate path per API. After the calls you can use complex node to ensure process returns to UI only after all the API executions are complete.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>