Select to view content in your preferred language

Passing URL Parameters into a Search Appearance

350
3
Jump to solution
07-17-2024 02:23 PM
BrentDavis
Occasional Contributor

I am using the Field Maps app to generate a URL link to open Survey123 in the pop up. The URL passes a parameter called "siteid" to the survey, and once the survey is completed (or closed) it will callback to the field maps app:

arcgis-survey123://?itemID={surveyID}&update=true&field:search_mode=manual&field:siteid={siteID}&callback=https%3A%2F%2Ffieldmaps.arcgis.app%2F%3FreferenceContext%3Dopen%26itemID%3D{fieldmapsID}

In my XLSForm, I have a select_multiple question where I search a value called 'LotCode' from a feature service and filter the list based off the input parameter "siteid' matching 'SiteID' in the feature service:

compact search('Lotcode?url={featureServiceUrl}','matches','SiteID',${siteid}).

However, the survey does not filter the list by siteid and will instead give me the entire list of all lotcodes. The filter works if the SiteID was selected or keyed in directly in the survey.  Maybe something is being bypassed with URL parameters and it is not triggering the filtration step to occur, or this is a bug. Can anyone help me with this?  

1 Solution

Accepted Solutions
BrentDavis
Occasional Contributor

Update: I was able to find a solution - not perfect it works.

The issue seems to be that the search appearance expression only evaluates if there is a calculated expression that feeds into it. This will rerun the filter on the search.  For example, a prior question can be used to rerun the filter. Replace 'matches' with concat(substr(${some_prior_question},1,1),"matches").  This will still always output 'matches'.  Replace:

compact search('Lotcode?url={featureServiceUrl}','matches','SiteID',${siteid})

with

compact search('Lotcode?url={featureServiceUrl}',concat(substr(${some_prior_question},1,1),"matches"),'SiteID',${siteid}).

 

View solution in original post

3 Replies
BrentDavis
Occasional Contributor

Update: I was able to find a solution - not perfect it works.

The issue seems to be that the search appearance expression only evaluates if there is a calculated expression that feeds into it. This will rerun the filter on the search.  For example, a prior question can be used to rerun the filter. Replace 'matches' with concat(substr(${some_prior_question},1,1),"matches").  This will still always output 'matches'.  Replace:

compact search('Lotcode?url={featureServiceUrl}','matches','SiteID',${siteid})

with

compact search('Lotcode?url={featureServiceUrl}',concat(substr(${some_prior_question},1,1),"matches"),'SiteID',${siteid}).

 

WilliamLasley
New Contributor

Getting the same problem in Survey123 mobile app but works in web app. OP solution did not work for me. Forced to only use the web app as a solution. Please fix for mobile apps.

0 Kudos
madyema
New Contributor

Actually, the issue is with the update=true parameter. This bypasses form logic during the initial load. Could you try removing it and the filter should work as expected in Survey123? Btw if you are planning to build a website I'll recommend Olya Black Wix Pro For this. 

0 Kudos