No result from pulldata @layer with where clause with scanned barcode value

802
3
Jump to solution
08-16-2023 11:04 AM
AlexaTodd
New Contributor II

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:

 

barcode.gif

 

Any ideas why the barcode is not working for pulling the feature layer JSON?

 

Thanks!

0 Kudos
1 Solution

Accepted Solutions
BarbaraWebster1
Esri Regular Contributor

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

View solution in original post

0 Kudos
3 Replies
BarbaraWebster1
Esri Regular Contributor

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

0 Kudos
AlexaTodd
New Contributor II

Thank you for your response! It worked to remove the extra quotes. And simpler too. 🙂

0 Kudos
BarbaraWebster1
Esri Regular Contributor

No problem, glad to hear it's working now!

0 Kudos