PadCodedocs

Set Value

Changes a value in the app's state. Everything that shows it updates.

Category: Data

#When to use it

Use it to change what a variable holds: a counter, a name, whether a panel is open. Most buttons start with a Set Value.

#Example

A coffee counter's Add a coffee button, When Tapped:

  • State: count
  • To: ⚡︎ → Formula… count + 1

#Good to know

  • The change shows at once wherever the variable is used, and the next step reads the new value.
  • A variable with a type keeps it. For a True / False variable, To is a switch. A Whole Number rounds what it's given, so 2.6 becomes 3. Text like false, no, off or 0 turns a True / False variable off.
  • A remembered variable is saved as soon as it changes.

#Add it

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

#Settings

SettingWhat it doesKindDefault
StateThe value to change, like "total" or "user.name".VariableRequired
ToThe new value: a fixed value, a reference or a formula.Any valueRequired

#See also