Power Fx function
Set — Power Fx function reference
Set a global variable.
Syntax
powerfx
Set( VariableName, Value )
Examples
powerfx
Set(gblUser, User().FullName)
→ Available app-wide
powerfx
Set(gblCartCount, CountRows(colCart))
powerfx
Set(gblTheme, If(Toggle1.Value, "Dark", "Light"))
Common mistakes & gotchas
- A global variable's type is inferred from the first Set() call that creates it; setting it to an incompatible type later (e.g. text after a record) causes an error.
- Global variables live only for the app session — they are not saved anywhere, so a refresh resets them to blank.
- Prefer Set for app-wide state and UpdateContext for screen-local state; mixing the two for the same concept makes cross-screen debugging harder.
Related Power Fx functions
From App & navigation