<?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>Loop to get the manager details</title><link>https://community.appian.com/discussions/f/general/20672/loop-to-get-the-manager-details</link><description>How to achieve this functionality ? 
 If user&amp;#39;s manager band is between 0 to 3 then consider manager details of that user, if user manager is more than 3 then manager&amp;#39;s manager(next linemanager) band should be checked and if it is not between 0 to 3 then</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Loop to get the manager details</title><link>https://community.appian.com/thread/80582?ContentTypeID=1</link><pubDate>Tue, 30 Mar 2021 01:39:51 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8d035883-f6f4-4b62-a568-c9cc59e90da2</guid><dc:creator>lohithk0003</dc:creator><description>&lt;p&gt;Thanks Chris.&lt;/p&gt;
&lt;p&gt;It’s worked &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: Loop to get the manager details</title><link>https://community.appian.com/thread/80575?ContentTypeID=1</link><pubDate>Mon, 29 Mar 2021 20:50:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c5d2c990-d997-4b7d-9a7d-9dc6ce3b682f</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;This is a great case for a small recursive function that calls itself until it finds the data &amp;quot;bands&amp;quot; you are looking for.&lt;/p&gt;
&lt;p&gt;In this example we take a User input and check for a title containing &amp;quot;VICE PRESIDENT&amp;quot;, if it is found return the current user, if not, call itself with the manager of the user to loop until we find a Vice President.&amp;nbsp; You would need light updates such as swapping in your &amp;quot;band&amp;quot; information in line 3 and returning the manager in line 7 instead.&lt;/p&gt;
&lt;p&gt;Note when testing recursive functions, you MUST SAVE any code changes before testing the rule, or the current changes will be calling the previously saved version of the rule (and you will bang your head on debugging).&amp;nbsp; Additionally, make sure you have the proper code checks in place to prevent any situation that would allow the rule to infinitely run (such as the maximum call number check) - otherwise this can cause a major performance degradation of the server.&amp;nbsp; This rule has a setting of 10 for a maximum run count.&lt;/p&gt;
&lt;p&gt;rule!test_recur_getUser(user):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;if(
  or(
    search(&amp;quot;VICE PRESIDENT&amp;quot;,user(ri!user,&amp;quot;titleName&amp;quot;),1)&amp;gt;0, /* Search user title for VICE PRESIDENT */
    ri!callNumber&amp;gt;=10, /* set a max for safety! */
  ),
  /* Title found (or max loop hit), return user! */
  ri!user, 
  /* Call self recursively with user&amp;#39;s supervisor */
  rule!test_recur_getUser(
    user: user(ri!user,&amp;quot;supervisorName&amp;quot;),
    callNumber: if(rule!APN_isEmpty(ri!callNumber),2,ri!callNumber+1)
  ) 
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>