a!forEach( items: pv!id, expression: a!save( rule!Test_getDossierByDossierId( dossierId: fv!item, pagingInfo: a!pagingInfo(1, - 1) ), pv!id ).data)
Discussion posts and replies are publicly visible
Multiple:
- Using a process variable in an a!save() seems not correct
- What is that pv!id in line 8 doing?
- Querying data in a loop is a bad performing anti-pattern
In fact, I want to make a loop in a process variable "pv!id" to retrieve all data
Then just run loop like below, don't do a!save. Because you just need data
a!forEach( items: pv!id, expression: rule!Test_getDossierByDossierId( dossierId: fv!item, pagingInfo: a!pagingInfo(1, - 1) ).data )
Or if you rule rule!Test_getDossierByDossierId accepts multiple type rule input dossierId then you don't need to run loop
rule!Test_getDossierByDossierId( dossierId: pv!id, pagingInfo: a!pagingInfo(1, - 1) ).data
Thanks Dhananjay Kumar. It works
Which way did you go?
I choose the first way because my rule!Test_getDossierByDossierId accepts one type rule input : dossierId
Keep in mind that your approach will fail in a code review. When you have a list of IDs, always try to fetch them in one query. That results in only a single connection to the database instead of one for each ID.