Problem with conditional visibility in Field Maps App

2883
10
12-22-2020 02:50 AM
PeterMcDonnell
New Contributor III

Hi all,

I am having some difficulty with conditional visibility in the form created with the Field Maps app.  Basically I can't get it to work as I thought it would.

I have read the available documentation that I could find.

Basically if the answer to one of the first questions is no then no more of the form should be visible as the questions are irrelevant.

The screen shots show what I have attempted using arcade code. The expression I applied to the group was $feature.SeaBirdsPresent ! = "No".  My understanding is that if 'No' is given as the answer to that question then this group will not be visible in the form.

I have never used this code before and this is the first week of using the Field Maps App so apologies for any rudimentary mistakes.

Thanks for your time.

Peter

10 Replies
AaronPulver
Esri Regular Contributor

Hi @PeterMcDonnell 

 

There a few things that could be going on. Is the field "SeaBirdsPresent" using a coded value domain with a list of options to select from?

If it is, then you might need to use the the "DomainName($feature, "SeaBirdsPresent")" to compare the strings instead of just comparing the values.

0 Kudos
PeterMcDonnell
New Contributor III

Hi Aaron,

Thanks for the response and my apologies for not getting back to you sooner.  I have only returned to the office today after holidays.  

I will try out that solution and let you know if that solves it.

Thanks again in taking the time to respond.

Regards,

Peter

0 Kudos
PeterMcDonnell
New Contributor III

Hi Aaron, 

That worked to some extent but not as I expected. I went back to the ArcGIS Pro Project I created and SeaBirds field uses a coded value domain with two options 'Yes' and 'No', perhaps this is incorrect usage.

Using "DomainName($feature,"SeaBirdsPresent") if one answers "No" in the Field Maps App to the Sea Birds Present Question it turns red.  You can still see and fill in the rest of the questions that follow, which I was hoping you wouldn't be able to.  However, you cannot Submit the record - Submit is greyed out.

For the survey in question that sea birds aren't present at a given location is important as it can mean a number of things including breeding failure or colony collapse.  So it is important that this information is recorded.  However I was hoping that the other questions would just not be available and that a record that Sea birds were not present at a given site on a given date would be submitted as a record.

Again, I am still learning so I may have made a mistake elsewhere.

I hope that makes sense.

Regards,

Peter

0 Kudos
AaronPulver
Esri Regular Contributor

Hi Peter,

What you are trying to do should work. It might be easier if I can access to your feature layer and map to further assist you. If you'd like you can create a new group in AGOL, share your map and layers into that group and then invite me to that group. My account is aaron_nitro.

PeterMcDonnell
New Contributor III

Hi Aaron, thanks for all your help.  

Unfortunately it won't be that straight forward. I  cannot share from the AGOL account where the feature layer and map are hosted.  

I think I will go through a similar process when I get a chance and host it on my private AGOL account.  I can just make it public for you to take look at as my own licence is for personal use so I cannot invite anyone to groups.  I probably won't get a chance until the weekend.   

Once again thanks for offering your time and help.

Regards,

Peter

0 Kudos
AndreaB
Occasional Contributor III

Hi Aaron,

I'm having the same problem. I can't seem to figure out how this code is supposed to be. I'm trying DomainName($feature,"PoleFramingMatchGIS") == "No"

But that doesn't seem to do anything. 

Would you be able to help?

Thanks,

Andrea

0 Kudos
Valven
by
New Contributor

Hello Aaron,

I am looking to use the conditional visibility as a selector for groups and fields. this is something that has served me well in S123 in tailoring the experience for the field workers to the task they are entering.

The example seems to behave opposite to what I would like to see happen. I have something that gives me the behavior that I would like, but it will only honor the first in the expression. This is new to me as well, but reading and trying to understand has taught me some. 

This what I have so far, All 4 examples kind of work. In that the first part of the expression is honored and the 2nd and 3rd are ignored. I have a tasks that I would like to have share a group or field. 

any help would be appreciated. Thanks

I had added this to a post that is marked solved. sorry for the repeat post.

0 Kudos
AaronPulver
Esri Regular Contributor

Hi @Valven 

I'm not exactly sure what workflow you're trying to do but here are some examples that might help you.

This will show the field that this expression is defined on in if the value of the "LastActivity" field is one of the values in the array.

// Show this field if the value is one of these
IndexOf(["Replace Meter", "Replace Register", "Install Meter"], DomainName($feature,"LastActivity")) >= 0

This will show the field that this expression is defined on in if the value of the "LastActivity" field is NOT one of the values in the array.

// Show this field if the value is not one of these
IndexOf(["Replace Meter", "Replace Register", "Install Meter"], DomainName($feature,"LastActivity")) < 0

 The IndexOf function can determine if a value exists in an array. Because both expressions are comparing to an integer, the result is a boolean (true or false) which should do what you want. This simplifies the expression a lot - you should be able to just paste this in and use it.

Hope this helps.

Valven
by
New Contributor

Aaron,

Thank you. for expanding my knowledge of expressions. IndexOF with DomainName is exactly behavior I was looking for. Mirrors the Relevant field in Survey123 Connect for hiding groups.

This is just an observation with using Conditional Visibility in this scenario.  Anticipating the the field crews selecting a task then realizing they need to select a different one. After 3+ changes fieldMap dose stop working. As long as you go straight to the task and maybe one change there is no issue.

Thank you. Thank you.

0 Kudos