title: Supervisor hierachy level logic by just using while loop
body: <p>I have tp create a fast formula in fusion application. fast formula is simple english mathematical calculation which uses while and if and not many functions from other languages - C, JAVA etc.</p>
  
  <p>I have to create a fast formula which caluclated the manager hiearchy.</p>
  
  <p>eg :</p>
  
  <p>If tony is ceo of the company and karthik and mutthu are suboordinates.
  and karthik further has SMITH as a sub ordinate then tony is at level 0,
  Karthik and muthu at 1 and smith at 2. It like traversing down the tree.</p>
  
  <p>Can anyone please suggest a logic of how j can use the variable i used in the while loop to tell me the 
  hierchy level. I have two functions i can use in fast formula- greatest and least.</p>
  
  <p>My formula goes like :</p>
  
  <pre><code>/*=========== INPUT VALUES DEFAULTS BEGIN =====================*/
  INPUTS ARE CMP_IV_ASSIGNMENT_ID (number), CMP_IV_PLAN_ID (number), CMP_IV_PERIOD_ID (number)
  /*=========== INPUT VALUES DEFAULTS ENDS======================*/
  
  /*================ FORMULA SECTION BEGIN =======================*/
  
  
  L_PERSON_ID = 0
  L_ASSIGNMENT_ID = 0
  
  
  
  Supervisor_id = 0
  L_PERSON_NUMBER = 'XXX'
  L_ASSIGNMENT_ARR_ID[21] = 0
  L_JOB_LEVEL = 'B - 1'
  J = 1
  
  
  Supervisor_id = PER_ASG_MGR_MANAGER_ASG_ID --&gt; assignment manager id 
  L_PERSON_ID = Employee id 
  
  WHILE (J &lt; 10) LOOP
  (
  
  
  
  L_PERSON_ID = Employee id 
  L_ASSIGNMENT_ID = Supervisor_id
  
  
  L_ASSIGNMENT_ARR_ID[J] = PER_ASG_MGR_MANAGER_ASG_ID
  Supervisor_id = L_ASSIGNMENT_ARR_ID[J]
  J = J + 1
  
  )
  
  
  RETURN L_PERSON_ID , L_ASSIGNMENT_ID
  
  /*================ FORMULA SECTION END =======================*/
  </code></pre>
  
  <p>I know many ppl wont know the formula rules. But i just need the logic of how i can use while loop and return j to reflect the hierchy level.CEO being 0 , his subordinate being 1 so on and so forth.</p>