Nested for each and refreshing aggregates
Application Type
Reactive

I am trying to update a record in my database, based on number scanned/entered into a form I have created. In the text area, a list of numbers, separated by a new line, are entered. I have separated the string of numbers, using the text extension, String_Split, and saving the numbers to a list of Text. I would like to cycle through the list and compare it to numbers in the taken database. I have done this using a refresh aggregate. When it returns a list of records after being filtered (which in this case is just 1 anyway as the same number can only be issued once), it cycles through the list and updates the record based on the id the records.

However, only the first value on the list of Text is being updated. From debugging, it seems to be something wrong with the filter in the refresh aggregate. Can someone figure out where I went wrong? I've attached the module I'm working on in case you may need a closer look.


Test.oml

mvp_badge
MVP
Solution

Hi Tenisha,

I also had the same observation while reproducing the case (Sorry! I don't know the technical reason). So, as a solution, I suggest you create a separate local variable (NumberFilterValue) to hold the current record Number value in the loop 

and use/refer to the same local variable  (NumberFilterValue) value in the Aggregate Filter condition.

Based on your use case, I would suggest you to set the Aggregate Fetch property value to Only on demand

Refer to the attached .oml file


I hope this helps you!


Kind regards,

Benjith Sam

Test3.oml

OMG! Yes! This works! Thank you so much, I really appreciate it.

mvp_badge
MVP

You're most welcome. Glad to help you :)


Kind regards,

Benjith Sam

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