Hello,
I am building my first Survey123 and running into some difficulty with using pulldata function. I am using a web map with 15 feature layers (<county_name>_taxlots) as the basemap for a geopoint question. The idea is that if a customer chooses a specific county, that the pulldata function will access the appropriate feature layer (shared through AGOL) to return attributes like tax lot number, zoning, and locator info like Township, Range and Section.
The setup is:
1) a AGOL published web map (vector tiles for visualization only) with 15 feature layers (tax lots of 15 different counties)
2) a select-one question to indicate the county where a property or set of properties exists
3) a integer question to indicate the # of lots involved (used to set a repeat count)
3) a geopoint question (within a repeat) to place markers on indicated tax lots
So how can I write the calculation so that the pulldata request goes to the correct (1 of 15) feature layer. I'll add the complication that several of the layers use different field names for the same data. Do I need 15 different lines, each with a pulldata calculation? Or can I set up some sort of if-then clause?
I was successful when dealing with a single county and feature layer. But when I expanded the concept to cover multiple counties, then I ran into some problems.
pulldata does not work inside an if regardless. Common issue.
Do I need 15 different lines, each with a pulldata calculation? - yes that is what I would do. Then put a relevant tied to your drop down on each one. That way only one will fire.
Since each one is its own layer I do not know another way.
Unless maybe you could if statement just the URL then use that var in the pulldata. That may work if you put a relevant on the URL if line and the pulldata so that it only fires after they pick a choice, then it runs the if, then it runs pulldata. It would depend if the query is the same on all 15? If each query field for example is different then you probably need 15 lines.
It will take some testing because pulldata can be very finicky. 123 does not run lines top to bottom. It runs in a function order. So often pulldata will run before other fields causing it to fail. Relevant helps with this - usually string-length(${pick list field}) > 0.
Hope that all makes sense