Select to view content in your preferred language

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

3455
18
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
18 Replies
RobertAnderson3
MVP Regular Contributor

I was struggling with this, I feel like the fact it needs to be in a concat() with the quotes would be handy to include in your Tricks of the Trade blog about pulldata(@layer) or documentation somewhere. I had tried the style of "MANHOLE_ID= '${question1}'" with the single quotes directly and it didn't want to work which surprised me.

Thank you for the solution!

AshneyDaniel
New Contributor II

Well done.

Doesn't make any sense but this is key!

"MANHOLE_ID='hard coded text value'" works.

"MANHOLE_ID='${question1}'" does not work.

concat("MANHOLE_ID='", ${question1},"'") works.

HelenaBallart
New Contributor

Hello,

I have the same problem, I work with text and I use your code,  no error appears but no value appears either.

pulldata("@layer","getValue","attributes.perfil_professional","URL",concat("nom_ramader='", ${nom_ramader},"'"))

The Featre layer permits queries, can you help me?

Much appreciated.;)

 

RobertAnderson3
MVP Regular Contributor

I can't see anything that seems off really, the only thing I'd say is make sure everything is spelt matching, and case matching as well! (Upper vs lower case letters).

The only other difference I see with yours compared to mine is I used single quotes around my variables instead of double quotes.

0 Kudos
OussamaMerhi
New Contributor III

Hi Ismael,

How can I add two conditions. ex.: id=123 and name="xyz"

Hope to hear soon.

 

Best,

Oussama

0 Kudos
OussamaMerhi
New Contributor III

Dear Ismael,

 

I have managed to do it.  "id="123 and "name='xyz'"

Best,

Oussama

0 Kudos
lannguyentl
New Contributor III

Hi All,

Has anyone really made the pulldata@layer work? I have tried all the possibilities and even the sample code from ESRI does not work.

I upgraded to 3.18 but it keeps saying: TypeError: Cannot read property 'toString' of underfined in expression: pulldata("@layer",....)

This is an useful function, hope that it should work.

 

Thanks, 

Lan

0 Kudos
CoryBowlin
New Contributor III

I was able to get it to work in 3.18, but not like the ESRI sample.  I had to place the entire pulldata function into a single field. If I separated the concat and referenced it, pulldata retrieved the wrong record. @lannguyentl include your pulldata syntax and I bet someone can find the problem. 

0 Kudos
MihaRobar
New Contributor III

I am also struggling with pull data from feature layer. Can you share last solution that worked?

 

0 Kudos