<?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>iterate the values and assign to user</title><link>https://community.appian.com/discussions/f/general/20429/iterate-the-values-and-assign-to-user</link><description>Im trying to write a expression rule where there are two ri variables , one ri variable has type list of users and other ri variable is of type list of numbers. 
 
 something like below 
 ri!users: {&amp;quot;abc&amp;quot;,&amp;quot;def&amp;quot;} 
 ri!numbers: {1,2,3,4,5,6,7} 
 
 i have</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: iterate the values and assign to user</title><link>https://community.appian.com/thread/79651?ContentTypeID=1</link><pubDate>Wed, 17 Feb 2021 19:18:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e8d19400-80c9-4326-af2c-9870dd8a0549</guid><dc:creator>Carlos Santander</dc:creator><description>&lt;p&gt;This needs further work (extracting common rules, validations, etc.), but it should give you a good starting point:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;= a!localVariables(
  local!userCount: count(ri!users),
  local!numberCount: count(ri!numbers),
  local!resultCount: max(local!userCount, local!numberCount),
  
  a!forEach(
    items: 1+enumerate(local!resultCount),
    expression: a!localVariables(
      local!userIdx: mod(fv!index, local!userCount),
      local!numberIdx: mod(fv!index, local!numberCount),
      {
        user: ri!users[if(local!userIdx=0, local!userCount, local!userIdx)],
        number: ri!numbers[if(local!numberIdx=0, local!numberCount, local!numberIdx)]
      }
    )
  )
)
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>