For-Loop Item Values Not Saved
When building a screen that edits items inside a For each loop container, editable components inside the loop must bind to the current loop item rather than the parent collection.
For example, the loop may iterate over:
screen.request.itemsThe For each loop creates a local loop variable for the current item (named item in this example).
Components inside the loop should bind directly to the current loop item.
For example:
item.descriptionitem.quantityitem.budgetAmountitem.currencyDo not bind components to the full collection path as indicaed in the following code snippet:
screen.request.items.descriptionscreen.request.items.quantityscreen.request.items.budgetAmountscreen.request.items.currencyIf components are incorrectly bound to the collection instead of the loop variable, values may appear in the UI but will not save to the database.
Common symptoms of incorrect loop bindings
Section titled “Common symptoms of incorrect loop bindings”You may experience one or more of the following issues:
- Values entered inside the
For eachloop are not saved, - Data appears correctly in the UI but is missing after saving or reloading,
- Updates inside the loop affect the wrong item,
- Child item values are empty after submission, or
- Parent records are saved but loop-item data is missing.
- Open the screen that contains the
For eachloop. - Select each input component inside the loop.
- Check the component binding.
- Replace collection-level bindings with loop-variable bindings.
- Save the screen.
- Rebuild and retest the application.