pulldata("@layer") fails when WHERE clause includes value from earlier question

2569
15
Jump to solution
10-31-2022 02:05 PM
TobiasFimpel1
Occasional Contributor III

My question1 asks the user to identify the asset id. That works beautifully:

  • autocomplete search("Manhole_IDs?<url>", ‘contains’, ‘MANHOLE_ID’)

 

Then I have a note that needs to display the work order number based on the asset id. It runs the following calculation:

  • pulldata("@layer", "getValue", "attributes.WORKTASK_NUMBER",<url>, "MANHOLE_ID= ${question1}")

 

Is the where clause supposed to allow for inclusion of variables, i.e. values from previous questions?

If I hard-code the value in the where clause then the pulldata function returns the correct value. The documentation doesn't clarify if variables are supported, and Esri's Survey123 Connect samples don't show it either.

 

0 Kudos
1 Solution

Accepted Solutions
IsmaelChivite
Esri Notable Contributor

Is the ManholeID a number or text? If text, the Manhole ID must be enclosed with quotes.

 

pulldata("@layer", "getValue", "<json_path>",<url>, concat("MANHOLE_ID='", ${question1},"'"))

View solution in original post

15 Replies
IsmaelChivite
Esri Notable Contributor

 

Did you try this?

 

pulldata("@layer", "getValue", "<json_path>",<url>, concat("MANHOLE_ID=", ${question1}))

TobiasFimpel1
Occasional Contributor III

Still no luck. I've tried using a variable in the where clause in all kinds of ways, never gotten it to work.

I appreciate the quick reply.

0 Kudos
JoshuaReyling
New Contributor II

When I enter my pulldata request in the above format, I get the following syntax error in my text box: 

Invalid regular expression flag 'P' in expression: pulldata("@layer", "getValue", "attributes.scientific","https://services1.arcgis.com/KNdRU5cN6ENqCTjk/arcgis/rest/services/PlantList/FeatureServer/0",concat("name='", /Bee_Test/PlantsBees/Observations/Plant/PlantCommon ,"'"))

call in my xlsForm: pulldata("@layer", "getValue", "attributes.scientific","https://services1.arcgis.com/KNdRU5cN6ENqCTjk/arcgis/rest/services/PlantList/FeatureServer/0",concat("name='",${PlantCommon},"'"))

PlantCommon is a dropdown of common names

0 Kudos
CoryBowlin
New Contributor III

I'm getting a very similar error. Even the ESRI sample survey 123 form "Query a Feature Layer" has the same error.

0 Kudos
CoryBowlin
New Contributor III

The error may have been fixed in a later survey 123 release. I just downloaded 3.18 and it works in the sample form "Query a Feature Layer"  like it should, but in my own environment the wrong value is returned inconsistently. Sometimes the correct value is returned, and sometimes the correct value appears for a brief second and then changes to the same incorrect value first record in the table. I am out of ideas. 

DustyJordan
Occasional Contributor

Hey Joshua,

Did you ever get this syntax error figured out? I'm running into the same problem with my pulldata(@layer...) calculations.

0 Kudos
JoshuaReyling
New Contributor II

Unfortunately, no. But because my list was not going to grow much larger than 250 items, I added it to the survey itself without taking a hit to performance.

0 Kudos
IsmaelChivite
Esri Notable Contributor

Is the ManholeID a number or text? If text, the Manhole ID must be enclosed with quotes.

 

pulldata("@layer", "getValue", "<json_path>",<url>, concat("MANHOLE_ID='", ${question1},"'"))

TobiasFimpel1
Occasional Contributor III

Perfect! That did it. I can't believe I didn't catch that myself. Thank you for the quick replies, Ismael, you and the Survey123 team are the best. Much appreciated.