Assignment operator (:=)
A reference to a property which should be assigned the value on the
right-hand side of
The value to assign to the property.
The value assigned to the property.
This operator can only be used from an action formula. It is typically invoked from a formula associated with the OnPress property of a formula button.
:= can also be used to assign a value to a name defined through
the LET function.
This operator is specific to Calcapp.
Creating a button that performs calculations
Ordinarily, Calcapp performs calculations as the user types, with results appearing instantaneously. Sometimes, though, it is better if results appear only after a button is pressed.
:= can be used to realize such a button. Create a formula button
and associate a formula such as the following with its OnPress property:
The key is to separate different calculations with ;;;. A single button can assign values to any number of fields.
Assigning a value to a property
For instance, this action formula makes a text box invisible:
This action formula makes an enabled button disabled, and a disabled button enabled:
Sending a report and giving feedback using
The following action formula sends a report through email and makes a text box visible if sending the report succeeds. Another text field — containing an error message — is made visible if sending the report fails:
The formula above names the last two parameters
invoked when sending the report succeeds — and
invoked when sending the report fails — to aid readability. Naming parameters
If sending the report is successful, a text box named SuccessBox is made visible and a text field, named ErrorField and used to display an error message, is made invisible.
OnFailure parameter has access to a value named
Error, which among other things provides a text string named
Message, explaining what went wrong. (Refer to the documentation
for AWAIT and
to learn more.)
If sending the report fails, ErrorField is made visible and the error message is assigned to the value of ErrorField.
Assigns 4 to the Value property of Field1.
Assigns 4 to the Value property of Field1. Spelling out the name of the Value property is optional.
Toggles whether TextBox1 is visible.