Select to view content in your preferred language

Using Calculated Values to populate Contingent Values

2335
17
Jump to solution
07-22-2023 05:20 AM
OliverIshmael
Frequent Contributor

I have set up a field group with Contingent Values to help filter combo box fields on my form. For some of these fields, I am using Calculated Values to populate default values to save users time.

The contingent values function properly within the form but once the user has filled out all the fields in the field group, Field Maps displays the error: 'Value combination is invalid' and then the survey can't be saved.

Is this a known issue / is there a workaround?

0 Kudos
1 Solution

Accepted Solutions
KevinBurke
Esri Contributor

Thank you @OliverIshmael. I've been able to resolve the issue.

For the Region and Site fields, your calculated expression needs to be changed to the following:
- return "1" for the Region field

return "2" for the Site field

The reason for this is because the value above represents the code in the coded-value domain applied to those fields. When the form loads in Field Maps, you will see the correct descriptions of "North West Wales" and "Coed y Brenin Forest Park" applied and the contingent values will work successfully. 

In arcade the syntax above assumes the value getting passed is the code and not the description, which is why it wasn't working previously. 

Thanks

-Kevin

View solution in original post

17 Replies
KevinBurke
Esri Contributor

Hi @OliverIshmael 

Thank you for sharing that information. So for clarification, in Field Maps if you utilize calculated expressions to populate the values from those contingent value fields, then you receive an error for the fields with an invalid combination. Is that correct?

If you manually entered the same values for the fields instead of using calculated expressions, is the issue still reproducible?

How are the expressions being ran to populate the fields with values? Are they populated as soon as the form is loaded or does the user need to do something to trigger those values to get written?

What is an example of one of the expressions you've written to add these values to a field?

Are you able to share the map with us?

Thank you

-Kevin

 

 

 

 

0 Kudos
OliverIshmael
Frequent Contributor

Hi Kevin, - I'll add comments below...


@KevinBurke wrote:

Hi @OliverIshmael 

Thank you for sharing that information. So for clarification, in Field Maps if you utilize calculated expressions to populate the values from those contingent value fields, then you receive an error for the fields with an invalid combination. Is that correct? Yes

If you manually entered the same values for the fields instead of using calculated expressions, is the issue still reproducible? When i edit the form to remove the calculated values and then select the values manually instead, there is no problem.

How are the expressions being ran to populate the fields with values? I am using calculated expressions

Are they populated as soon as the form is loaded or does the user need to do something to trigger those values to get written? Yes, they are populated straight away once the form loads, with no input from the user.

What is an example of one of the expressions you've written to add these values to a field? Here is the calculated expression i use in the Arcade Editor: 

return "North West Wales"
 

Are you able to share the map with us? I wish there was an easy inbuilt way to do this (to share a map with a copy of my data, while preserving the forms) but the attached warning message suggests otherwise 

OliverIshmael_0-1690282524608.png

 

Thank you

-Kevin

 

 

 

 


 

0 Kudos
KevinBurke
Esri Contributor

Thank you for that information @OliverIshmael 

How many fields are part of the field group?

How many of those fields are you calculating the values into as oppose to the field user manually selecting the value? 

For example, I have a field group with the 4 fields for Type, CommonName, Genus, Species. When I originally configured my contingent values in Pro, there is no valid combination that includes any `Null` values. Therefore if I only calculate the values for Type = Evergreen, and CommonName = Holly Oak, then when my form loads I will see an invalid combination error, which is expected since the other 2 fields are left `Null`. If I then populate the remaining 2 fields in the field group, then the combination is valid and the error is removed. 

In general when working with contingent values, if you only have a single valid combination, we will autocomplete the other fields automatically with that combination. However that only works when the values are manually chosen from the fields. If you're calculating the values, any values not calculated will need to manually selected. 

Thanks

-Kevin

 

0 Kudos
OliverIshmael
Frequent Contributor

There are 4 fields within the field group:

OliverIshmael_0-1690464318893.png

Calculated Values are used to populate Region and Site. Initially these are blank but once the user picks values for Access Point and Facility, then Region and Site are filled in correctly by Field Maps. However, when the user clicks to the next field it then displays the error that combination is invalid.

0 Kudos
KevinBurke
Esri Contributor

Thank you for that info @OliverIshmael 

Would you mind attaching a screen recording of the workflow from the mobile device? This will help me visualize the process being followed per your explanation above. 

Thank you

-Kevin

0 Kudos
OliverIshmael
Frequent Contributor

I have created a 20 second screen recording in mp4. It is 19mb but the max attachment I can post here is 9mb, so is there another way I can share this with you?

0 Kudos
KevinBurke
Esri Contributor

Hi @OliverIshmael , this may still not work given the size of the file, but you can try emailing it to me at kburke@esri.com

 

Thanks

-Kevin

0 Kudos
OliverIshmael
Frequent Contributor

I have emailed it to you from Outlook which has a 20MB file attachment limit. Hopefully your ESRI email client will accept it.

0 Kudos
KevinBurke
Esri Contributor

Hi @OliverIshmael 

The email didn't come through for some reason. Was it zipped or just stand-alone?

The file might also just be too large. 

A few options:

- You can try resending in a zip, unless that's what you already tried.

- You can capture a smaller video <10mb to see if that works

- You can share the map with me and I can test on my end following your steps. 

In general I just need to see the behavior and the order with which values are chosen and I could probably repro this with my data. But I am just trying to understand the configuration. 

 

Thank you

-Kevin

0 Kudos