Conditional-based questions in Field Maps Designer

One of the coolest options in the Field Maps Designer form builder is creating conditional-based questions. Their foundation is the conditional statement in the Arcade language, which in this case is created automatically.
First, we need to create the question in our form builder and set it as hidden and Required (Pic. 1).

Field Maps Designer new question marked as required

Pic. 1 Adding new questions to the form builder which must be hidden and required at once.

The Required option isn’t available by default. It must be switched on later. These are the fundamental basics of conditional-based questions because usually, we need to explain something more like If NOT – Why? and so on. Moreover, the Required option shows the stroke 0 symbol visible on the right, which means, that in this case null values are not accepted. The Visible option is always switched on by default. Now we should turn it off as we don’t want to have this question visible when a certain answer isn’t provided.
Next, we must save the form for further use in the Logic section, where the Arcade-based dynamic behavior can be applied to the form.
After that, we can use the “Settings” icon just next to the switched-off Visible option and go straight away to the Launch Arcade Editor button (Pic. 2).

ArcGIS Online Arcade expression

Pic. 2 Creating a new expression for conditional-based question visibility in Field Maps Designer.

Before you click the Launch Arcade Editor button you should check the generic Arcade formula for your condition, which looks like this:

$feature["OBJECTID"] ==

where the “OBJECTID” is one of the default fields created by ArcGIS Online when the feature-hosted layer is produced.
This formula must change concerning the question we want to base our condition on.
Instead of OBJECTID, you must provide the field name for the question, which defines the created condition. In our case, it will be validation instead (Pic. 3), because we refer to the question directly above.

FIeld Maps Designer picking up field name from the question for arcade function

Pic. 2 Picking up the field name from our previous question to build up the proper Arcade function.

Next, when you back to the conditional-based question you will spot, that after clicking the “Settings” icon your expression already exists. Because it’s empty we need to enter Edit or Edit Arcade. When clicking Edit you will be redirected to the Expression builder dashboard as shown above (Pic. 2). When clicking “Edit Arcade” you will go straight away to the Arcade editor (Pic. 4).

Your formula should be:

$feature["validation"] == 'No'
Field Maps Designer setting up the Arcade formula

Pic. 4 Arcade editor in Field Maps Designer, setting up the formula for the conditional-based question, where: 1 – wrong (or not completed) formula with the red sign shown and the “Next” button inactive; 2 – The formula correct with the “Next” button active (2A).

When your formula is correct you can click Done. You can alternatively go to the Expression builder dashboard and check your expression (Pic. 5).

Field Maps Designer expression builder dashboard

Pic. 5 Field Maps Designer expression builder dashboard with the correct expression.

Finally, it’s time to check our conditional-based question (Pic. 6)

Field Maps Designer conditional-based question required

Pic. 6 The arcade expression works as expected. When the answer to the question above is “No” then the auxiliary conditional-based question emerges. The asterisk at the end of the question points out the necessity of the answer without which the form cannot be submitted.

This is the simplest approach to the Arcade language, which makes the ArcGIS Online dynamic. By simply changing the generic formula, we can prepare the questions based on some specified conditions.

Mariusz Krukar

 

Youtube: