If your map contains feature layers (hosted feature layers, hosted feature layer views, hosted table layers, subtype group layers, or ArcGIS Server feature layers), you can define forms that editors can use when they update field values for the feature layers in the web map. You can define a form for every feature layer in the map or only those layers that you know the users of the map will need to edit.
Tip:
If you own the feature layer that is in the map or you are an organization administrator, you can configure forms for the feature layer before you enable editing on the layer.
When you configure a form, you specify what form elements the form contains and how the elements appear. Having a form helps guide editors to the correct fields and allowable attribute values for each editable field.
The form can be saved as part of the map or the layer. When you share the map or layer, others can use the forms you define to edit the feature layers or related records in the map. To learn more, see Save the form.
Note:
Currently, you can configure forms in Map Viewer in ArcGIS Online and ArcGIS Enterprise and in Field Maps Designer.
Before configuring a form
Before you configure a form for a feature layer in your map, familiarize yourself with the layer's contents and field settings. What a field contains affects whether you create element groups for fields. The settings that are applied to a field—such as whether null values are allowed, whether a default value is defined, and whether the layer owner defined lists for the field—affect how you format the field elements on the form.
Configure a form
You can configure an input form for each feature layer in the map. You define what fields (elements) appear on the form and where they are placed.
When an editor selects a feature in an editable feature layer, the form appears so the editor can input attribute values for that layer.
Follow these steps to configure a form for a feature layer:
- Confirm that you are signed in and that you have privileges to create content.
- On the Contents (dark) toolbar, click Layers to open the Layers pane.
- Add a feature layer to the map.
- With the feature layer selected, click Forms on the Settings (light) toolbar.
The Configure form window appears.
- Use the following options alone or in combination to add elements to the form.
Form elements are field groupings and the input fields that appear on the form. Field elements are based on existing fields in the feature layer.
- Convert the existing pop-up—If you configured pop-ups for the feature layer, you can use the existing pop-up configuration as a starting point to configure the form.
- Create groups of elements—You can create expandable and collapsable group elements to keep logically related information together on the form.
- Add descriptive text—You can add descriptive text to the form to provide contextual information that describes the purpose of a form element.
- Add fields—Choose which fields in the layer to add to the form. When a field is added to the form canvas, it becomes a form element.
- Add related record elements—You can add related record elements to the form when the feature layer has a related table or feature layer.
- Add contingent value field groups—If the data in the feature layer has contingent values defined, the Field groups list is present in Form builder. This allows you to add logically related groups of fields to the form canvas in a single step.
- After you add fields and groups as elements to the form canvas, format each element.
- Optionally, write Arcade expressions that define conditions that affect an element.
- When you finish adding, formatting, and configuring conditional expressions for the elements on the form, click OK.
- Save the form.
Note:
If you close the map without saving, you lose the form.
If you need to change the form, repeat the steps above. Be sure to save the form after you edit it.
Convert the existing pop-up
If the feature layer has pop-ups configured, click Convert pop-up to add fields from the pop-up to the form canvas.
Fields that are not part of the pop-up configuration appear in the Fields list in Form builder. You can drag them onto the form canvas to add them as elements to the form, as described in the next section.
After you add fields as elements to the form, you can create groups to aggregate related fields or proceed with formatting field elements.
Note:
Fields that contain high-accuracy GPS metadata can only appear on the form if they are imported from an existing pop-up. Because these fields should be populated from GPS devices only, disable editing for the corresponding form elements.
Add descriptive text
You can add descriptive text to the form to provide contextual information or additional details about form elements. Descriptive text is read-only and cannot be altered by form editors.
Follow these steps to add a descriptive text element to the form:
- Drag the Info element from the Form Elements list to the form canvas.
The Properties pane appears, allowing you to edit the descriptive text element.
- In the Formatting section, in the text editor, do any of the following:
- Enter plain text in the text editor.
- Use the text formatting tools to format the text.
- Click Select field or expression or type { and select a field or expression. Use this option if you want unique text for each field.
- In the Visibility section, add an Arcade attribute expression to apply rules for when the text should appear in the form. See Configure conditional visibility for details.
- Exit the Properties pane to commit your changes and return to the Form builder panel.
- Optionally, after you add a descriptive text element to the form, proceed with adding field elements.
Add fields
Choose which fields in the layer to present to editors as form elements. In most cases, you add fields that the editors will use to update values.
For example, if the feature layer contains the following fields—Site Name, Site Type, Build Status, Landscaping, Edit Date, Editor Name, Creation Date, Creator Name, ID, and Shape—you might place only the Site Name, Site Type, Build Status, and Landscaping fields on the form because the Edit Date, Editor Name, Creation Date, Creator Name, and ID fields are automatically populated, and the Shape field is populated when editors add a feature to the layer.
You can also add fields for reference and disable editing on the form element. In the previous example, you might include the Edit Date field as an uneditable element on the form so the editors can see when the feature was last updated.
- Use one of the following methods to add fields as elements to the form:
- Add all fields to the form—Click Add all in the Fields list to include all the fields in the layer on the form. When you have a lot of editable fields in the layer, adding all the fields and removing one or two system or uneditable fields is faster than adding individual fields.
- Add a selection of fields to the form—To include a specific selection of fields in the form, press the Ctrl key, click the fields to include, and drag them to the form canvas.
- Add fields one by one—To add a single field to the form at a time, double-click it or drag it to the form canvas.
Tip:
If the layer or table contains a large number of fields, you can use the Find Fields search bar in the Fields list to locate a specific field.
- Optionally, after you add fields as elements to the form, create groups or proceed with formatting field elements.
Add related record elements
If you created a relationship class in the geodatabase in ArcGIS Pro before publishing a hosted feature layer, if the hosted feature layer was created using a template that includes a relationship class, or the hosted feature layer was created for a form containing a repeated section in ArcGIS Survey123 Connect, you can add a related record element to the form. This allows users to view and add related records associated with the hosted feature layer, such as a table, while filling in the form.
Tip:
For instructions to create a relationship class in ArcGIS Pro, see the following help pages:
For example, on a form used to monitor urban tree health, a related table can include inspections of each tree. By adding a related record element to the form, you can add a new inspection to the related table while editing attributes for the tree feature.
Note:
- A relationship class must exist for the data before a related record element can be added to the form.
- In order to edit related records, the layer and its related table(s) or feature layer(s) must be in the map, and each related table or layer must have editing enabled.
- One-to-one and one-to-many relationship cardinalities between a feature class (origin) and table (destination) or feature class (destination) in the source data are currently supported.
- Adding related record elements to the form is currently supported for hosted feature layers and hosted feature layer views. Hosted tables are also supported if they participate in a relationship that has a destination feature layer or table.
Follow these steps to add a related record element to the form:
- In the Related record list, double-click a related record element or drag it to the form canvas.
The related record element is added to the form canvas.
- Format the properties of the related record element.
Create groups of elements
To group related fields in the same physical location on the form, create a group element. Grouping elements is similar to placing questions in the same section on a paper form. Groups on digital forms have the added advantage that they can be contracted to show only the group heading until the form user expands the group.
For example, on a form to update content in a trails feature layer, create a group for all the fields related to trail properties, such as the trail name, type, and difficulty. You can create a separate group for the fields that record trail maintenance information, such as maintenance crew name, the date maintenance was last performed, and the description of the maintenance performed. If you choose to open the form with groups collapsed, the editors see only the two group names until they expand the groups.
Follow these steps to group related elements together on the form in a collapsable section:
- Drag the Group element from the Form Elements list to the form canvas.
A form element is added to the form canvas.
- Drag related fields into the group.
You can drag fields from the Fields list in the Form builder panel or from the form canvas.
- Select the group element to edit its properties.
The Properties pane appears, allowing you to edit the following information:
- Display name—Provide a name that describes the fields that are contained in the group. This is similar to a section heading on a paper form. This value is required.
- Description—Provide a description for the group.
- Initial state—By default, groups are expanded when the form opens, which means all fields are visible automatically. Uncheck the Expanded check box if you want the initial state of the group to be contracted. Form users will click the group to expand it and see the fields it contains.
- Conditional visibility—Add an Arcade attribute expression to apply rules for when the group should appear in the form. See Configure conditional visibility for details.
Tip:
You can remove all form elements from a group by selecting Ungroup from the group toolbar. You can remove multiple elements from the group by pressing Ctrl, selecting each element you want to remove, and dragging them out of the group.
Add contingent field groups to the form
If the data owner created contingent field groups in ArcGIS Pro for the data, the contingent field groups appear in the Field groups list next to the form canvas.
Because the fields are related—the values of one field determine or limit what values you can set for the other fields—the contingent fields are added to the form in a group element when you add them from the Field groups list. Contingent fields should stay grouped together so editors can fill them out subsequently in Map Viewer. If you remove a field from its field group, a warning displays.
Contingent field groups that share one or more fields are listed together. They are added to the form as one field group.
Field groups that you must add to the form appear in the Required section of the list. Field groups are required if they were configured as restrictive in ArcGIS Pro, which means the attribute values that editors provide when editing the fields in this field group must comply with the contingent value definitions.
Caution:
If you do not add required contingent field groups to the form canvas, editors cannot use the form to edit the feature layer.
To learn how to create contingent field groups in ArcGIS Pro, see Create and manage contingent values.
Follow these steps to add contingent value field groups to the form:
- Use one of the following methods to add field groups to the form:
- Add fields one by one—To add a single field group to the form, double-click it or drag it onto the form canvas.
- Add a selection of field groups to the form—To add a specific selection of field groups to the form, press the Ctrl key, click the field groups to include, and drag them to the form canvas.
- Add all field groups to the form—Click Add all in the Field groups list to include all the fields in the layer on the form.
Tip:
If the layer or table contains a large number of field groups, you can use the Find field groups search bar in the Field groups list to locate a specific field group.
- After you add field groups as elements to the form, format the group elements and format the field elements.
Apply formatting to form elements
When you select a form element on the form canvas, the Properties pane appears.
The previous section described setting properties for group elements.
For field elements, the Formatting section of the Properties pane shows properties that you can define for the element on the form and those that are inherited from the layer and cannot be altered for the form. The following sections describe the properties you can define for field elements on the form.
Define a display name
Every form element requires a value for the Display name setting. The display name is the label that accompanies the element on the form.
For fields, the default display name is the same as the field name. Accept the default or type a more user-friendly or descriptive display name for each field.
Format text elements
If a form element references a string field, follow these steps to format the element:
- Select a text form element to open the Properties pane.
- Click the Input type drop-down menu and select one of the options.
- Barcode—This can be used only in apps that have a barcode reader. If you choose this input type, the element will revert to a single line of text in apps that cannot read barcodes as input, such as Map Viewer.
- Text - Single line—The input field on the form will show a single line of text.
- Text - Multiline—The input field on the form will be several lines high. Use this input type for text fields with a high maximum length to allow editors to see all text in the field.
- To display text in the field that prompts the editor for the correct value, type that text in the Placeholder field.
For example, you could type Type the applicant's first name as placeholder text for a field that stores the first name of the person applying for a loan.
Placeholder text appears inside the input field element and is replaced by the text the editor provides.
You cannot set placeholder text for a field that has a default value defined.
- In the Description field, provide text that explains what the values in the field represent.
The description appears below the element on the form.
- Set values for Min. length (minimum character length) and Max. length (maximum character length) for the element.
Sometimes, a feature layer is published with a default text field size rather than a length that makes sense for the field. For example, a field that can have only a finite number of values, such as yes, no, or unknown, might have a field length in the feature layer of 256 characters. But you can set a minimum and maximum of 1 if you want editors to type only y, n, or u when editing values in the field.
You cannot set a maximum character length that is longer than the field length.
- Check the check box next to Required to define that editors must input a value to the field.
See Define elements as required for more information.
- To prevent editors from using the form to update values in this field, uncheck the Editable check box.
For example, you may include a field for reference purposes, but you don't want editors to alter the values in the field.
Format date and time elements
Follow these steps to format elements that reference date and time fields:
- Select a date and time form element to open its Properties pane.
- If the field is a date field type, click the Input type drop-down menu and select one of the options.
- Date—This allows the editor to provide a date.
- Date and time—This allows the editor to provide a date and time.
- In the Description field, provide text that explains what the values in the field represent.
The description appears below the element on the form.
- For time only or timestamp offset elements, choose the time precision that the form will allow editors to input.
- hh—Allows editors to input hours.
- hh:mm—Allows editors to input hours and minutes.
- hh:mm:ss—Allows editors to input hours, minutes, and seconds.
Note:
Seconds can be stored in the field, though they will not display in ArcGIS Online.
- For date elements, optionally set values for the Start date and End date parameters to restrict a date range that editors can use.
For example, for a date field in a new layer that records inspections that will be completed in the first quarter of the year, set the start date to the first day of the year and the end date to March 31 for the appropriate year.
- For date and time elements, optionally set values for the Start time and End time parameters.
For example, for forms that are used during business hours only, you can restrict the start and end times so they do not fall outside your business hours.
- To allow editors to specify a time zone when editing timestamp offset elements, check the Allow users to set time zone check box.
- Check the check box next to Required to define that editors must input a value to the field.
See Define elements as required for more information.
- To prevent editors from using the form to update values in this field, uncheck the Editable check box.
For example, you may include a field for reference purposes, but you don't want editors to alter the values in the field.
Format number elements
If the element uses a feature layer field that is a double, an integer, or a big integer data type, follow these steps to format the form element:
- Select a text form element to open the Properties pane.
- Click the Input type drop-down menu and select one of the options.
- Barcode—This can be used only in apps that have a barcode reader. If you choose this input type, the element will revert to the default input type in apps that cannot read barcodes as input, such as Map Viewer.
- Number - Double—If the field in the layer is defined as a double, the app where the map will be used for editing does not accept a barcode as input, and editors must input decimal numbers, choose Number - Double.
- Number - Integer—If the field in the layer is defined as an integer, a big integer, or a double, the app where the map will be used for editing does not accept a barcode as input, and editors should not input decimal numbers, choose Number - Integer.
- To display text in the field that prompts the editor for the correct value, type that text in the Placeholder field.
For example, you could type Type the applicant's first name as placeholder text for a field that stores the first name of the person applying for a loan.
Placeholder text appears inside the input field element and is replaced by the text the editor provides.
You cannot set placeholder text for a field that has a default value defined.
- In the Description field, provide text that explains what the values in the field represent.
The description appears below the element on the form.
- Check the check box next to Required to define that editors must input a value to the field.
See Define elements as required for more information.
- To prevent editors from using the form to update values in this field, uncheck the Editable check box.
For example, you may include a field for reference purposes, but you don't want editors to alter the values in the field.
Format an element that contains a list of three or more values
If the field in the feature layer has a list defined for it that contains three or more values, you can configure the form element to appear as a combo box or option buttons.
- Select a form element that references a field with a value list defined to open its Properties pane.
- In the Formatting section, click the Input type drop-down menu and select one of the following options:
- Combobox—Form users choose a value from a list of available options.
- Radio buttons—All options appear on the form with option buttons next to them. Form users click the appropriate button.
If the list contains a lot of values (for example, seven or more values), a combo box saves space on the form.
- In the Description field, provide text that explains what the values in the field represent.
The description appears below the element on the form.
- Check the check box next to Required to define that editors must input a value to the field.
See Define elements as required for more information.
- To prevent editors from using the form to update values in this field, uncheck the Editable check box.
If the form element is not editable, the button or list option setting on the form shows the existing value for the attribute. If you add a feature, no value shows for the combo box or button elements unless the field has a default value defined.
Format elements with two possible values
If the field in the feature layer has a list defined for it that contains only two possible values, and the field has a default value set in the layer, you can define that element to appear as a toggle switch on the form or appear as a combo box or buttons.
If the field in the layer does not have a default value set, you can configure the element to appear as a combo box or buttons on the form.
- Select a form element that references a field with a two-value list defined and a default value defined to open its Properties pane.
- In the Formatting section, click the Input type drop-down menu to choose how to present this element:
- Combobox—Form users choose one of the values from a drop-down list.
- Radio buttons—The two options appear on the form with buttons next to them. Form users click the appropriate button.
- Switch—Form users enable or disable a toggle switch.
You can change which value equates to an enabled switch by clicking the Switch order of values button next to the switch values.
If the field does not have a default value set and you choose Switch for the input type, the element displays as a combo box on the form.
- In the Description field, provide text that explains what the values in the field represent.
The description appears below the element on the form.
- Check the check box next to Required to define that editors must input a value to the field.
See Define elements as required for more information.
- To prevent editors from using the form to update values in this field, uncheck the Editable check box.
If the form element is not editable, the button, list option, or toggle switch setting on the form shows the existing value for the attribute. If you add a feature, no value shows for the combo box or button elements. For switch elements, the default setting is displayed on the form.
Format related record elements
You can customize how related record elements appear in the form by formatting their description, sort order, and the number that can be previewed. Follow these steps to format related record elements:
- Choose a related record element to open the Properties pane.
- In the Description field, provide text that explains what the values in the field represent.
The description appears below the element on the form.
- Click the Sort by drop-down menu and choose the field used to sort the related records.
- Click the Sort order drop-down menu and choose how the related records should be sorted.
If you sort by a string, double, or integer field, you can sort by ascending or descending value. If you sort by a date field, you can sort by the most recent or least recent value.
- Click the Preview count drop-down menu and choose the number of related records that can be previewed in the form.
Choosing a value greater than three may require additional scrolling on the form and is not recommended.
Note:
You can create a separate form for the related table, and choose which fields from the related table to display and how to format them.
Define elements as required
To enforce the input of data for a field, you can configure form elements so that they require an entry. For example, if all applications require a submission date, configure the submission date element to be required.
When editors use the form, they see an asterisk next to the fields that require input, and they cannot save their edits until a value is provided.
- Click a field form element to open its Properties pane.
- In the Logic section, check the Required check box.
A * Required chip appears on the form element, indicating that editors must supply a value for this field.
Add logic to make the form conditionally dynamic
You can make the form dynamic based on the following logical conditions that you define using the ArcGIS Arcade expressions:
- Conditionally visible—Conditionally show or hide form elements.
- Conditionally required—Conditionally require input for form elements.
- Conditionally editable—Conditionally enable editing for form elements.
- Calculated values—Automatically calculate data based on attribute, geometry, and account information.
Once defined, you can reuse expressions for other form elements.
Configure conditional visibility
You can conditionally show or hide form elements based on values added to previous fields. For example, a Building Assessment form includes a field to indicate whether there is water damage. It also includes a group form element containing fields related to water damage. A conditional visibility expression can be applied to the water damage group so it only appears if water damage is indicated in the earlier field. To create a conditional visibility expression, complete the following steps:
- Click a field form element to open its Properties pane.
- In the Logic section, click the Expressions button next to the Visible check box.
The Expressions pop-up appears, displaying expressions previously created for the form.
- Click New expression.
The Expression builder window appears. The builder allows you to write and preview an expression in Arcade before saving it to the selected form element.
- In the Title text box, add a title for the expression.
- Define the expression.
For example, if a water damage group element only needs to appear if water damage was indicated in an earlier field, the following condition can be used to build the expression:
- Field name—Water damage
- Operator—is
- Value—Yes
Here is what the same expression looks like in Arcade syntax:
DomainName($feature, "water_damage") == "Yes"
Map Viewer applies the Arcade Form Constraint profile to evaluate whether a feature meets the criteria defined in the expression. If a value other than Yes is indicated in the water_damage field, the water damage group will not appear in the form.
- Click Done to close the expression builder.
A </> Visibility chip appears on the form element, indicating that the conditional visibility expression has been applied to the group or field.
Now that you created the expression, you can apply it to any form element. You can see which elements are using the expression by clicking the number next to the expression in the Expressions pop-up. See Reuse expressions to learn more.
Note:
You can duplicate, edit, or delete the expression at any time from the Conditional Visibility menu. To edit the expression using Arcade, click Edit Arcade from this menu.
Configure conditionally required elements
You can conditionally require form elements based on previous values entered in the form. For example, a debris description field should only be required if the length of the storm debris is greater than 3 meters.
- Click a field form element to open its Properties pane.
- In the Logic section, click the Expressions button next to the Required check box.
The Expressions pop-up appears, displaying expressions previously created for the form.
- Click New expression.
The Expression builder window appears. The builder allows you to write an expression and preview it in Arcade before saving it to the selected field or group.
- In the Title text box, add a title for the expression.
- Define the expression.
Each expression is defined by one or more conditions. A condition includes a field name, an operator, and potentially, a value. The list of available operators is determined by the type of field (string, number, or date).
For example, if a debris description field only needs to be required if the debris is greater than 3 meters, the following condition can be used to build the expression:
- Field name—debris_length
- Operator—is greater than
- Value—3
The following is the same expression in Arcade syntax:
($feature, "debris_length") > 3
Note:
To create more complex expressions, click Launch Arcade editor.
When you apply multiple conditions to the same element, you can choose whether all conditions must be true or only one condition must be true for the form element to be required.
ArcGIS Online applies the Arcade Form Constraint profile to evaluate whether a feature meets the criteria defined in the expression. If a value less than 3 is entered in the debris length field, the debris description field will not be required in the form.
- Click Done to close the expression builder.
A </> Required chip appears on the form element, indicating that the required expression has been applied.
Now that you created the expression, you can apply it to any form element. You can see which elements are using the expression by clicking the number next to the expression in the Expressions pop-up. See Reuse expressions to learn more.
Note:
You can duplicate, edit, or delete the expression at any time using the overflow menu in the Expressions pop-up. To edit the expression using Arcade, click Edit Arcade from this menu.
Configure conditional editing
You can conditionally enable editing for form elements based on previous values entered in the form. For example, editors should only edit values in a date_pipe_replaced field if the value for the pipe_replaced field value is set to yes.
- Click a field form element to open its Properties pane.
- In the Logic section, click the Expressions button next to the Editable check box.
The Expressions pop-up appears, displaying expressions previously created for the form.
- Click New expression.
The Expression builder window appears. The builder allows you to write an expression and preview it in Arcade before saving it to the selected field or group.
- In the Title text box, add a title for your expression.
- Define the expression.
Each expression is defined by one or more conditions. A condition includes a field name, an operator, and potentially, a value. The list of available operators is determined by the type of field (string, number, or date).
For example, if the date for a pipe replacement should only be editable if an the pipe_replaced field value is yes, the following condition can be used to build the expression:
- Field name—pipe_replaced
- Operator—is
- Value—yes
Here is what the same expression looks like in Arcade syntax:
($feature, "pipe_replaced") == "yes"
ArcGIS Online applies the Arcade Form Constraint profile to evaluate whether a feature meets the criteria defined in the expression. If a value other than 4367 is entered in the inspector ID field, the pipe ID field the will not be editable in the form.Note:
To create more complex expressions, click Launch Arcade editor.
If you use multiple conditions, you can choose whether all conditions must be true or only one condition must be true for the form element to be editable.
- Click Done.
An </> Editable chip appears on the form element, indicating that the required expression has been applied.
Now that you created the expression, you can apply it to any form element. You can see which elements are using the expression by clicking the number next to the expression in the Expressions pop-up. See Reuse expressions to learn more.
Note:
You can duplicate, edit, or delete the expression at any time using the overflow menu in the Expressions pop-up. To edit the expression using Arcade, click Edit Arcade from this menu.
Add expressions to calculate field values
You can add a calculated expression to the form to calculate and populate data automatically. This saves time for editors and enforces data integrity by automating the calculation of the field value.
Use Arcade to build calculated expressions based on feature attributes and geometry. For example, you can add a calculated expression to a field that stores dates for a bridge inspection schedule. When the editor sets the bridge condition field's value to damaged, for example, the expression defined on the inspection date field can automatically schedule the next inspection to take place in a week's time by populating the bridge inspection field with that date.
Calculated expressions are dynamic, meaning they automatically update the form as information changes. As a result, editors can see the updated calculation before submitting the form. Because the value in the calculated expression field is populated by the expression, editors cannot type a value for that field in the form.
To create a calculated expression, complete the following steps:
- Click a field form element to open its Properties pane.
Caution:
If editing is enabled for the form element, the expression will not run.
- In the Logic section, click the Expressions button in the Calculated value section.
- Click New expression.
The Arcade editor window appears. The editor allows you to write and test an expression before saving it to the selected form element.
- In the Title text box, add a title for your expression.
- Write the calculated expression.
For example, the following expression checks whether polygon feature geometry is null before calculating the area in square meters. Additional examples are provided in the next section.
To learn more about calculating area with Arcade, see Area (Geometry Functions).if (IsEmpty(Geometry($feature))){ return; } else{ Area($feature, 'square-meters') }
For a list of all the functions offered in Arcade, see the Arcade Function Index.
- Click Run to test the expression and make sure it doesn't result in an error.
- Click Done to close the Arcade editor.
A </> Calculated chip appears on the form element, indicating that the calculated expression has been applied.
Now that you have created the expression, you can apply it to any form element by selecting the form element and clicking the expression you created. You can see which elements are using the Arcade expression by clicking the number next to the expression in the Properties pane under Calculated expressions.
Note:
You can duplicate, edit, or delete the expression at any time from the Calculated expressions menu.
Calculated expression examples
The following are examples of calculated expressions:
- Provide date information—The following expression provides the current date for a date field:
To learn more about date information you can access with Arcade, see Date Functions.return Today();
- Extract information from intersecting layers—The following expression is applied to a ZIP code field in the form and extracts a ZIP code value from an intersecting parcel layer:
To learn more about extracting information from intersecting layers with Arcade, see Intersects (Geometry Functions).if (IsEmpty(Geometry($feature))){ return; } else{ var parcels_FS = Intersects($feature, FeatureSetByName($map,"Redlands parcels")); if (Count(parcels_FS) == 1){ return Text(First(parcels_FS).ZIP_CODE); } }
For a list of all the functions offered in Arcade, see the Arcade Function Index.
Reuse expressions
After you create an expression, you can reuse it across form elements. For example, you can conditionally display one form element based on the same expression used to require another, and you can use the same calculation to populate multiple fields.
Follow these steps to use existing expressions for form elements:
- While configuring the form, click a form element to open the Properties pane.
- In the Logic section, click the Expressions button next to the type of expression you want to add.
The Expressions pop-up or Calculate expressions pop-up appears, displaying expressions previously created for the form.
Tip:
The number next to the expression indicates the number of form elements the expression is currently applied to. Clicking this number opens another pop-up that displays the form elements and their properties that are currently using the expression.
You can remove the expression from any form element property by clicking the X on the chip displaying the expression type.
- Select the expression you want to apply.
A chip appears on the form element, indicating that the expression has been applied.
Save the form
When you're done editing, save the form. Click OK to close the Configure form window, and save the form to the map or to the layer:
- Save to the map—If the form is unique to a specific map, and you don't want to reuse it across other maps, save changes to the map. The form is saved to the map and won't appear in other maps that contain the layer.
- Save to the layer—To reuse the form across maps that contain the layer, save changes to the layer. The form is saved to the layer and can be reused across other maps.
Note:
Form changes that are saved to the map override form changes that are saved to the layer.
To save changes to the layer, you must own it, be a default administrator for your organization, or have the following privileges:
- Administrative privileges: Members: View all
- Administrative privileges: Content: View all
- Administrative privileges: Content: Update