Skip to content

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.items

The 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.description
item.quantity
item.budgetAmount
item.currency

Do not bind components to the full collection path as indicaed in the following code snippet:

screen.request.items.description
screen.request.items.quantity
screen.request.items.budgetAmount
screen.request.items.currency

If 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 each loop 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.
  1. Open the screen that contains the For each loop.
  2. Select each input component inside the loop.
  3. Check the component binding.
  4. Replace collection-level bindings with loop-variable bindings.
  5. Save the screen.
  6. Rebuild and retest the application.