Enabled property

SwitchField.Enabled — Logical

Special value available in formulas:

Item

Field

The field 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. Field1.VisibleField1,Visible and Item.VisibleItem,Visible are equivalent, for instance.

Whether the field is enabled. Disabled fields appear grayed-out and cannot be interacted with.

Associate a formula with this property to determine if users should be allowed to interact with a field based on information they have entered in the app, based on their email address or based on the tags you have assigned to them.

Use the Visible property instead to determine if a field is visible. This property only applies to input fields (whose Value properties are not associated with formulas), as users can never interact with output fields.

If this property is not set, it returns FALSE.

Disabling "factory setting" fields

Some fields hold important values which should be changed rarely, if ever. Typically, the calculations in the rest of the app rely on these values.

One approach is to put these fields in a separate settings screen. These fields should be made persistent (toggle the Remember value option in Calcapp Creator's inspector), so that any edits made by the user are retained. Finally, their initial values should reflect the factory values.

Formulas can access fields that are part of a settings screen (named Settings) like this:

Settings!SalesCommission * PriceSettings!SalesCommission * Price

To discourage users from changing these values, add a switch field, AllowEdit, whose function is to allow values to be edited only when the switch field is toggled to its "on" position.

To make the switch field work, associate the following formula with the Enabled property of all fields whose values should be protected:

AllowEditAllowEdit

To drive the message home, a text box could be added below the switch field, with text informing users why the values should not be changed. To make it appear only when the switch field has been toggled to its "on" position (allowing values to be edited), associate its Visible property with the formula AllowEditAllowEdit.

Examples

TermsAcceptanceTermsAcceptance

Makes a field enabled only if the user has accepted the terms and conditions, specifically if the switch field TermsAcceptance has been toggled to its "on" position.

ISODD(Field1) && (Field2 < 3)ISODD(Field1) && (Field2 < 3)

Makes a field enabled only if Field1.ValueField1,Value is odd and Field2.ValueField2,Value is less than 3.

Field1.ValidField1,Valid

Makes a field enabled only if Field1 is considered valid.

AND((Field1:Field5).Valid)AND((Field1:Field5),Valid)

Makes a field enabled only if all fields of the Field1:Field5Field1:Field5 range are valid (as determined by the Valid property of the fields). This range includes the two fields Field1 and Field5 and all fields that appear between them.

The formula (Field1:Field5).Valid(Field1:Field5),Valid returns a logical array with the same number of elements as there are fields in the Field1:Field5Field1:Field5 range, like this array: { TRUE, FALSE, TRUE, TRUE, FALSE }{ TRUE; FALSE; TRUE; TRUE; FALSE }. The AND function returns TRUE only if all elements of the array are TRUE.

AND(ISDEFINED(Field1:Field5))AND(ISDEFINED(Field1:Field5))

Makes a field enabled only if all fields of the Field1:Field5Field1:Field5 range are filled out (that is, have values which are not blank). This range includes the two fields Field1 and Field5 and all fields that appear between them.

The formula ISDEFINED(Field1:Field5)ISDEFINED(Field1:Field5) returns a logical array with the same number of elements as there are fields in the Field1:Field5Field1:Field5 range, like this array: { TRUE, FALSE, TRUE, TRUE, FALSE }{ TRUE; FALSE; TRUE; TRUE; FALSE }. The AND function returns TRUE only if all elements of the array are TRUE.

ENDSWITH(App.UserEmailAddress, "@example.com")ENDSWITH(App,UserEmailAddress; "@example.com")

Makes a field enabled only if the signed-in user has an email address that ends with "example.com". (To enable users to sign in, make your app private.)

USERHASTAG("Employee")USERHASTAG("Employee")

Makes a field enabled only if the signed-in user is associated with the tag "Employee". (To enable users to sign in, make your app private.)