How to Use the Defaults Function in Power Apps
Defaults gives you a data source's default values as a record. Its main job is to tell Patch "create a new item" rather than "update this one".
Microsoft Power Apps Canvas Apps, Power Fx Formulas, and Controls
View All TagsDefaults gives you a data source's default values as a record. Its main job is to tell Patch "create a new item" rather than "update this one".
Patch saves to a data source without a form. Give it a new record from Defaults and it creates an item; give it a record loaded from the list and it updates that item. One formula can do both, so the same button handles the first save and every one after.
Long text needs a limit, and people need to see how close they are to it. Set the text input's MaxLength, and add a label that counts what's typed: 247 of 4,000 characters.
For more than a line of text, such as a comment or a description, use the modern Text input control with Type set to Multiline. Give it room, a placeholder and an accessible label, and read what's typed from its Text.
A date from a data source isn't ready to read. Text turns it into words, either with a ready-made format that follows each person's language, or with your own pattern.
RGBA builds a color from red, green and blue values plus how opaque it is. Use it when you need an exact color the theme doesn't give you, such as the light yellow behind a warning.
Reset puts an input control back to its Default value and discards whatever the person typed. A text box that shows a saved record should be reset whenever the screen opens; otherwise it can keep old typing.
Select runs another control's OnSelect, as if someone had selected it. Its everyday use is Select(Parent) inside a gallery: a button in a row does whatever the row does.
A list is more useful when each row opens its details. In Power Apps, that takes three settings: make the gallery Selectable, navigate from its OnSelect with the selected row, and give each row a button so keyboard users can open it too.
A screen loads a saved record into a text input, yet when the screen opens again, the box shows text that was never saved. A text input keeps whatever was typed until its Default changes. If the saved value is the same as last time, nothing resets it. Reset in the screen's OnVisible fixes it.