I'm having trouble pulling data from a feature layer in AGO into my survey123 connect using a barcode to get the where clause value. When I hard code the id into the where clause rather than referencing it by the barcode variable, it pulls the JSON from AGO. I've added checks into the survey and the where clause that is built using concat() to combine the query with the value from the barcode appears the same as when I hard code the value. Attached is an example from my xlsform.
I tested the survey on my iPhone and scanned a barcode on the computer screen that I created using a free online generator:
Any ideas why the barcode is not working for pulling the feature layer JSON?
Thanks!
Solved! Go to Solution.
Hi @AlexaTodd,
When the where clause is created with a function like concat() it doesn't need to be wrapped in double quotes since the output is already a string. The extra quotes were being included in the feature layer request and causing issues.
I tried this calculation for the layer_json1 calculation and am seeing the query run successfully.:
pulldata("@layer", "getRecord", "https://services2.arcgis.com/McQ0OlIABe29rJJy/arcgis/rest/services/SurveyExampleLayer/FeatureServer/...", concat('sharps_box_globalid=', "'",${BarcodeID},"'"))
Thanks,
-Barbara
Hi @AlexaTodd,
When the where clause is created with a function like concat() it doesn't need to be wrapped in double quotes since the output is already a string. The extra quotes were being included in the feature layer request and causing issues.
I tried this calculation for the layer_json1 calculation and am seeing the query run successfully.:
pulldata("@layer", "getRecord", "https://services2.arcgis.com/McQ0OlIABe29rJJy/arcgis/rest/services/SurveyExampleLayer/FeatureServer/...", concat('sharps_box_globalid=', "'",${BarcodeID},"'"))
Thanks,
-Barbara
Thank you for your response! It worked to remove the extra quotes. And simpler too. 🙂
No problem, glad to hear it's working now!