PadCodedocs

Update in List

Changes fields of the list items that match a condition.

Category: Data

#When to use it

Use it to change items of a list in place: mark a to-do done, rename a note, change a quantity.

#Example

The check button in each row of a to-do Repeater, When Tapped:

  • State: todos
  • Where: it.id == item.id (it is each to-do in the list, item is this row's to-do)
  • With: tap Add field, name it done, and set it with ⚡︎ → Formula… !it.done

#Good to know

  • Every item where Where is true changes, so match on something unique, like an id.
  • With changes only the fields you list; the item's other fields stay as they are. Only items that are records change.

#Add it

Select a view, open the Inspector's Actions tab, pick when it runs, tap Add action and choose Update in List (under Data). Tap the step to open its settings.

#Settings

SettingWhat it doesKindDefault
StateThe list.VariableRequired
WhereWhich items: a formula where it is each item, like "it.id == params.noteID".Condition (a formula)Required
WithThe fields to change and their new values. Formulas here can use it.FieldsRequired

#See also