IncludedFields property
Special value available in formulas:
Item
The button this property is part of, enabling multiple checked items in the app designer to share the same formula and be updated all at once.
Consider the fields Field1 and Field2, which should
only be considered to be valid if their values are
greater than 4. Without using the Item
value, the Valid
property of Field1 would need to use the formula Field1 > 4Field1 > 4 and the Valid
property of Field2 would need to use the formula Field2 > 4Field2 > 4.
Using Item
, both formulas can read Item > 4Item > 4. This is useful
if you have many fields and you want to be able to update their
formulas all at once. To do so, click their check boxes in Calcapp
Creator and make sure that a checked field is selected. Then, when you
update a formula for one checked field, you update all the other
checked fields too, which is a great timesaver.
Use Item
in exactly the same way you'd use the regular
name. Button1.VisibleButton1,Visible and Item.VisibleItem,Visible are equivalent, for
instance.
The fields that are reset. This property is only consulted if the reset button has been instructed to determine what fields to reset using a formula, that is, if the FieldInclusion property returns FieldInclusion.CustomFieldInclusion,Custom.
This property requires a formula which returns an array.
Resetting a list of fields
This formula resets Field1, Field2 and Field3:
Resetting a range of fields
Ranges enable a large number of fields to be referenced in a compact way. This formula resets the fields Field1 and Field5, as well as all fields that appear between them:
This formula resets Field1, Field3 and Field5, as well as the fields that appear between Field3 and Field5:
Resetting all fields of a form group, screen or the entire app
To reset all fields of a form group or screen, simply write the name of the form group or screen in the formula:
This technique can even be used with the app object, to reset all fields in the app. Consider this formula:
The formula above resets all fields in the app if the ResetAllFields switch field has been toggled to its "on" position. Otherwise, it resets only Field1 and Field2.
Resetting fields conditionally with IF
Use IF inside of an array to reset fields based on logical conditions.
This formula unconditionally resets Field1, but Field2 is only reset if the value of Result is greater than 5:
Resetting fields conditionally with FILTER
When there are many fields to conditionally reset, using IF is not practical. FILTER takes an array as its first parameter and a logical array as its second parameter with the same number of elements as the first array. Only elements of the first array where the corresponding element of the second array is TRUE are part of the array returned from FILTER.
FILTER({ 1, 2, 3 }, { FALSE, FALSE, TRUE })FILTER({ 1; 2; 3 }; { FALSE; FALSE; TRUE }) returns the array { 3 }{ 3 }, because the elements 1 and 2 are associated with FALSE elements in the second array.
This ResetFields
formula uses FILTER to only reset number fields
whose values are greater than 3:
This formula only resets invalid fields:
FILTER can also consider all fields of a form group, a form screen or the entire app, using FormScreen.Fields, FormGroup.Fields or App.Fields, respectively.
This formula resets all visible fields in the entire app:
Use | to combine fields from various sources. This formula resets all visible fields that belong to either FormGroup1, FormScreen1 or a range of fields. This formula uses the LET function to give the fields a name to cut down on repetition:
Examples
Makes a reset button reset the fields Field1, Field2 and Field3.
Makes a reset button reset the fields Field1 and Field5, as well as all fields that appear between them.
Makes a reset button reset the fields Field1, Field3 and Field5, as well as the fields that appear between Field3 and Field5.
Makes a reset button reset all fields that belong to the form group FormGroup1 and the form screen FormScreen1.
Makes a reset button reset all fields in the app if the switch field ResetAllFields is toggled to its "on" position. Otherwise, the fields Field1 and Field2 are reset.
Makes a reset button reset Field1 unconditionally and Field2 only if the value of the number field Result is greater than 5.
Makes a reset button reset the fields Field1, Field5 and all fields that appear between them, but only if their values are greater than 3.