Our March release ships with a fair number of calculated properties that enable you to build more complex, dynamic apps. You will find complete documentation for all calculated properties in the revamped reference sidebar:
Determining visibility and whether fields and buttons are enabled
Fields, text boxes, calculation panel groups, list panel options and buttons all support the Visible property, which determines if the item should be visible using a formula returning a logical value. For list panel options, use the Visible property to determine if an option should be available (by referencing variables found on another panel using cross-references).
Fields and buttons both support the Enabled property, which for fields determines if an input field should be editable and for buttons whether the user should be able to press the button. Use this property to make buttons that send reports disabled until your user has filled out all required fields.
Determining field validity using a formula
Fields also support the Valid property, which enables you to determine if a field is valid using a formula. That way, you are able to do things like consider a text field invalid if the number of entered characters is less than six, flag a switch field as invalid if two other switch fields are also switched on or anything else you can express as a formula returning TRUE or FALSE.
Number fields can also be validated using the properties
MinimumValue and MaximumValue. Setting the
MinimumValue property to 0 is equivalent to assigning the
>= 0 to the Valid property, but is easier. (Also,
you can easily set a minimum value for multiple fields at the same
time by checking the desired fields in the app designer and then
setting the minimum value in the inspector.) While setting the
minimum value and maximum value to unchanging values in the inspector
is what you want to do most of the time, you can also determine them
using formulas, as they are full calculated properties.
If either the MinimumValue or the MaximumValue property is set, the value associated with the Valid property is ignored. In that case, the Valid property becomes a read-only property, which means that you can set a minimum value and a maximum value and reference the Valid property from other formulas to determine if a field is valid (which uses the MinimumValue and MaximumValue properties under the hood to determine validity).
Other calculated properties for fields
Fields support a number of additional calculated properties. InitialValue is expected to return the initial value for a field, that is, the first value of a field before a user changes it. You may recall that initial values are set using the app designer simply by typing a value into a field. That enables you to set initial values that never change, but by using a calculated property, you can set an initial value that takes into account other values entered by the user. A formula associated with the InitialValue property typically uses cross-references to refer to panels preceding the current panel.
In order to set the initial value using a formula, you need to select it explicitly from the property box in the formula bar. There is no fx button in the inspector that will take you to it. Going forward, we’ll try to keep the inspector free of clutter by placing some advanced properties only in the property box. Setting the initial value using a formula is one of those advanced features we expect not to be used very often (but to prove extremely useful in special cases, especially when you have large apps spanning multiple screens).
Number fields and date and time fields support the read-only property FormattedValue, which returns a text string version of the field value, formatted according to the rules set using the inspector. This property makes it easy to incorporate formatted values in text fields with multiple lines, without having to manually round values to a certain number of decimal places.
Calculated properties for panels
Finally, the NextPanelAvailable property is supported by calculation panels and text panels. It is a logical property (returning TRUE or FALSE) which determines if the next panel should be available. If the next panel isn’t available, the Next button is disabled in your apps. Use this property to ensure that, say, all fields are filled out or are valid before the user is allowed to move on to the next panel.
List panels don’t have the NextPanelAvailable property, because there isn’t a single panel following a list panel. To ensure that a certain panel following a list panel isn’t made available, use the Visible property on the individual list panel options.