Can't make list updates inside of ForEach

I have had problems with this in two apps now.  When I create a server side action where I loop through a data set, use current values in the loop to do a lookup that I want to store values of to a list (I've tried a aggregate list and a generated list eg.)   When I had the lookup aggregate inside the loop processing, it wouldn't even return a value.  I moved it to it's own server action and that worked to return the values I was looking for, and it makes the assignment (that I see in the debugger), but when I exit the loop the stored values in the list no longer exist.


I've done this dozens of times in older apps and it works fine, but in anything new I assemble, I have big issues with foreach loops like this.

I've included the OML file and you can find this specific code in the "Dashboard Screen" to populate the table labelled Pre/Post/Mth6: XXX.

CorrectiveExercise.oml

I cannot test, and it's just a possibility.

Can you do this



And try to see if you are getting data from the aggregate by debugging.

Hi James,

the order of your actions aren't right. You should do as following:

For the ListAppend you can assign directly the values returned from the action before:


Regards

I agree! And what I usually do in some cases is create an auxiliary variable of the data type that you are appending to a list, but this data type is not a list is just to organize the values that you are assigning and appending to the list append. I don't know if is not a best practice but that's how I do. :DD

Regards,

Márcio

Thanks!  I figured it out while I was waiting for a reply.  Amazing what a new day can do for you.  :-)

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.