Select to view content in your preferred language

Use a question to override pulldata (@layer) query result and continue with survey

219
4
Jump to solution
Wednesday
BrianOevermann
Frequent Contributor

Using Survey123 Connect. Survey published/to be published in ArcGIS Online. Not using an existing feature service but layer will be created as part of the survey. Users will 100% be using the browser for the survey--no requirement to download the app.

Our Sustainability Department is doing a Clean Air Giveaway event in which box fans and high quality filters will be given to residents of our City. Apparently the last event had a more than noticeable number of non-residents so they are hoping to use a geofence during registration to help prevent some of that (the reality is that one will never eliminate non-residents participating without a lot of vetting).

I have successfully set up the pulldata (@layer) to query the address to determine if in our city limits, using our custom site address locator. The locator contains only addresses within city limits plus a handful for areas in which we provide service such as water. It works well but as with all locators, sometimes an address isn't indexed or the user doesn't put in enough of the address to meet the minimum match thresholds, so we'd like to add a question asking, upon determining the address is not within the City, if the user believes it is an error. If 'yes', I'll mark a hidden field [not yet added to the survey] to indicate this was a rejected address but allow the user to fill in the form just so we have the info when Sustainability reviews the address.

This survey has added a number of new elements for me to learn how to implement, but I believe my logic is sound with how I've structured the questions/grouping for this. But in testing I am unable to submit the survey because the initial determination is that the address is outside the City. To be clear, if the user is honest and says they are outside the City, we want there to be a full stop and survey not move forward. That currently works as intended.

As a side inquiry, I concede that perhaps I am not testing properly for a constraint or relevant field entry. My constraint for determining if within the City is string-length(${CheckWithinCity})>0 and that functions properly. I haven't been able to determine what the return value is if the address is not even found in our data. I attempted to use "is null" but when I saved the Excel file Connect did not like that syntax. It accepts a string-length...=0 but I don't know if that is a proper value.

So, is there a way to override the 'out of city' determination and still allow submitting if I structure the follow-up question(s) appropriately? I appreciate any insight!

[Attaching my .xls. City limit service and locator are public. Test addresses: IN City - 130 E Sunset Way; OUT (not even in dataset) - 10334 240th Pl SE ]

0 Kudos
1 Solution

Accepted Solutions
Neal_t_k
MVP Regular Contributor

updating the relevant calc to this will make it visible only when they enter an address and the check return outside (0).  

string-length(${CheckWithinCity})=0 and string-length( ${Address})>0

 

View solution in original post

0 Kudos
4 Replies
Neal_t_k
MVP Regular Contributor

I think you should just be able add on to your constraint something like this:

string-length(${CheckWithinCity})>0 and ${AddressRejectedInError}='no'

 

0 Kudos
BrianOevermann
Frequent Contributor

@Neal_t_k , Thanks for replying. When I add the additional 'and' portion to the initial address check constraint, it doesn't have any effect.

Can you or someone clarify the constraint logic? If the constraint is "string length for <something> must be greater than 0", that means you would get the constraint message only if that isn't true, correct? Similarly for the relevant column?

If so, it appears that I have gotten at least a portion of this to work correctly now. It involved modifying your suggestion as well as reverting a couple of questions to not be required. I removed the Address question and also the 'rejected in error' question from being required. The address question, especially, is counter-intuitive because I absolutely want to ensure the capture of the address. However, the constraint and relevant settings force the user to enter an address--they can't move beyond the question in the survey if they don't input something.

Regarding your constraint suggestion, I modified it to be 'or' instead of 'and' as well as changed the 'AddressRejectedInError' to 'yes'. If the constraint logic above is true, I want to allow survey submission for situations where the address is inside the City or the user believes the address match rejected their address in error.

I have one remaining issue for which I hope I am just missing something basic: The question asking if the user believes the address was rejected in error is visible immediately after the user says they are in the City. I'd like it to only be visible if the address is outside the City. I have a relevant entry but I'm thinking I simply have the "test value" wrong. Reference the CleanAirSurveyQuestion image attached. The relevant entry is shown in the CleanAirSurveyRelevant image attached. I've also re-attached the latest .xlsx file in case it is helpful for any testing or if anyone wants to see how the form is otherwise working. Thanks for any insight!

0 Kudos
Neal_t_k
MVP Regular Contributor

updating the relevant calc to this will make it visible only when they enter an address and the check return outside (0).  

string-length(${CheckWithinCity})=0 and string-length( ${Address})>0

 

0 Kudos
BrianOevermann
Frequent Contributor

@Neal_t_k , thank you! That addition to the relevant calc did exactly what I was wanting. I appreciate your fresh eyes on the problem.

0 Kudos