Looping Through a Collection

  • Updated

Any time you loop through, or iterate, a collection of any type, there are some restrictions to consider. Inside the loop, you may change an individual member, but you may not change the collection itself.

For example, consider LineItems, a collection of LineItem entities in the InvoiceSample Rule Application.

mceclip0.png

As you loop through LineItems, examining each LineItem, you may change LineItem fields such as Quanity, but you may not remove the LineItem from the LineItems collection.

In InRule, this restriction applies to the For Each and the Execute Member Rule Set actions. While inside the loop, you may not:

 

 

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.