Recursive Calculation let() List Loop Question

Discussion created by cateringtraveller on Mar 10, 2012
Latest reply on May 25, 2015 by erolst

Hello all,


I am stuck on calculation that I cannot build the recursion into- I sucked at math, probably thats the problem.


Here is what I am trying to do:

Get a list of values. Go to the fist item of the list, do something with it and create a result,

go to the next item of the list; do something with it and create a result, add the result of this line to the result of the line before

end when I reached the last item of the list.

Output the result.


Here is what I have so far:


Let ([

list= List (of a field);

c=Valuecount (list);

$i = $i+1;

getitem=GetValue (list ; $i);

$result = getitem*dosomethingwithit


If ( $i = c; $result; getitem*dosomethingwithit + $result )



What am I doing wrong? I dont get the loop in my head in getting the calc to add to itself...


Thank you!