Action formulas can be used for a variety of things, including sending messages if a field is valid and displaying an alert box if it isn’t, as well as performing calculations only when a button is pressed.
This tip focuses on asking users questions, using message boxes. What makes this possible are the new action functions PROMPT and PROMPT.NUMBER.
Both action functions are used to ask users for information. PROMPT reads text strings, whereas PROMPT.NUMBER only reads numbers. AWAIT is used to read the entered values.
This formula asks the user to enter the email address where a report should be sent, before sending the report:
The second parameter to AWAIT has access to a special value named
Result
, containing the result communicated by the
action. For PROMPT the result is the text
string entered by the user. For PROMPT.NUMBER, the result is
the number entered by the user.
(This is similar to the third parameter to AWAIT, which has access to
a special value named Error
, with additional information
on what went wrong.)
If you like, you can use ->
to rename the
Result
value:
You can ask the user any number of questions:
When asking multiple questions with PROMPT, it is necessary to rename
the Result
value. If we don’t, there is no way to access
results other than the last one.
Finally, use CONFIRM to ask users to confirm a choice. This formula asks the user to confirm before resetting all fields of the app, immediately followed by displaying the first screen: