LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  while loop frustrating me

    Employee
    Posted 07-04-2015 11:43

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: dhrobertson

    hi there,

    I'm trying to do a accumulated MonthToDate given 12 columns of potential data.

    what I thought of doing was to create a list of all 12 columns (labelled col1-col12), separated by a comma. then, get the current month number which currently is 7

    then create a while loop setting a counter to 0 and another to the month number
    then a loop..

    while counter1 is < countermonthnumber

    accumulator = split(list,",").getitem(counter1)

    total = total + accumulator.int() # total is holding the running accumulated accounts from the split


    and eventually emit the total which should be column1+2+3...+7

    needless to say I cant get this to work and clearly I'm making this more complicated than it needs to be as it should be simple.

    any ideas please? thanks!

    I want to get the sum of the first 7 cols, so 155 (just a random set of numbers pasted below)

    node:Static_Data
    bretype:core::Static Data
    editor:sortkey=5598292f5a3e0983
    output:@40fe6c55598828e5/=
    prop:StaticData=<<EOX
    col1:unicode, col2:unicode, col3:unicode,col4:unicode,col5:unicode,col6:unicod e,col7:unicode,col8:unicode,col9:unicode,col10:uni code,col11:unicode,col12:unicode
    2,4,56,78,3,4,8,90,10,33,21,24
    EOX
    editor:XY=380,240
    end:Static_Data


  • 2.  RE: while loop frustrating me

    Employee
    Posted 07-05-2015 20:23

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ryeh

    If the columns are already in order, then you don't have to separate them with commas. Use inputFields to get a list of the fields, and then index to get the appropriate column.
    Attachments:
    sumColumns.brg