Visible property

Field.Visible — 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 visible.

Associate a formula with this property to determine if users should see 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.

To prevent users from interacting with a field without hiding it, use the Enabled property instead.

If this property is not set, it returns FALSE.

Showing fields one at a time

Form screens with many fields can look intimidating. One way to make them look less cluttered is to divide them into several form screens, with one following the other. The NextScreenAvailable property can be used to prevent users from moving to the next screen until you have collected the information you are looking for.

Another way to make form screens look less busy is to show a field only when the preceding field has been filled out to your satisfaction. Associate a formula with the Valid property of a field to notify the user if a value is not valid and use the ValidationMessage property to provide a message informing the user how to fix the problem.

Let's say that the first field the user is expected to fill out is Field1, that the second field is Field2 and that you have associated a formula with the Valid property of Field1.

To make Field2 appear only when the user has entered a valid value in Field1, associate this formula with the Visible property of Field2:

ISDEFINED(Field1) && Field1.ValidISDEFINED(Field1) && Field1,Valid

(&& should be read as "and.")

We recommend that blank fields are considered valid. As such, you need to use the ISDEFINED function to also check that the user has entered a value.

If you have no need to determine if a field is valid, and simply want to check if the user has typed something into a field before showing the next one, you only need to use the ISDEFINED function. Associating this formula with Field2.VisibleField2,Visible makes Field2 appear once the user has entered any value in Field1:

ISDEFINED(Field1)ISDEFINED(Field1)

Enabling a single choice to be made

A text drop-down field is the traditional way to enable a user to make a selection. The choices available to the user are only visible when the user is interacting with the field, meaning that the text drop-down field does not take up much space, even when there are many options.

What if you want to show all the options up front, though, without the user having to interact with the field? Switch fields, combined with toggling visibility through this property, can be used to achieve this.

Here is a sample app:

The idea is that every option is represented by a switch field, with related switch fields being part of the same form group. Initially, all switch fields are toggled to their "off" positions. Once a single switch field is toggled to its "on" position, all the other switch fields disappear. If the same switch field is toggled to its "off" position, the other switch fields appear once more.

The sample app first asks users to select their favorite color and then, once that is done, asks them to select their favorite season. The switch fields are housed in two form groups, one for colors (housing Red, Green and Blue) and one for seasons (housing Winter, Spring, Summer and Fall).

There is a hidden field in every form group that records the choice made by the user. Here's the one for colors, named FavoriteColor:

IF(Red, "Red", Green, "Green", Blue, "Blue")IF(Red; "Red"; Green; "Green"; Blue; "Blue")

If the user has not made a selection, IF assigns a blank value to the value of FavoriteColor.

To make a switch field only appear if it has been toggled to its "on" position, or if no selection has been made, a formula must be associated with the Visible property of each and every switch field.

Here is the formula for Red.VisibleRed,Visible:

Red || ISBLANK(FavoriteColor)Red || ISBLANK(FavoriteColor)

(|| should be read as "or.")

To make the form group for seasons only appear once a favorite color has been selected, associate the following formula with the Visible property of that form group:

ISDEFINED(FavoriteColor)ISDEFINED(FavoriteColor)

Both form groups record the selection the user made through their labels. This is achieved by associating a formula with the Label property of each form group.

This is the formula for the Label property of the first form group:

"Favorite color" & IF(ISDEFINED(FavoriteColor), " — " & FavoriteColor)"Favorite color" & IF(ISDEFINED(FavoriteColor); " — " & FavoriteColor)

Examples

TermsAcceptanceTermsAcceptance

Shows a field 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)

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

ISDEFINED(Field1) && Field1.ValidISDEFINED(Field1) && Field1,Valid

Shows a field only if Field1 is considered valid and it has a defined value.

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

Shows a field 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))

Shows a field 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.

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

Shows a field only if all fields of the Field1:Field5Field1:Field5 range are filled out (that is, have values which are not blank) and 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 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 }. Each element indicates whether the corresponding field has a defined value.

(Field1:Field5).Valid(Field1:Field5),Valid also returns a similar array, but each element indicates whether the corresponding field is valid.

When && is applied to two arrays, a single logical array is returned, where each individual element is only TRUE if the elements at the same position in the two arrays are both TRUE. The net effect is that an array is returned, where each individual element indicates whether the corresponding field is both valid and has a defined value.

Finally, AND is applied to the resulting array and only returns TRUE if all elements of it are TRUE. The end result is that the formula only returns TRUE if all fields of the Field1:Field5Field1:Field5 range have defined values and are valid.

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

Shows a field 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")

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