Select to view content in your preferred language

Pull Function Will Not Populate Based On Key Field

467
2
Jump to solution
10-10-2024 04:28 AM
Marc_Patti
Occasional Contributor

I have an issue where I need to populate a field in one feature class (Building Permits) with data from another feature class (Building Inspections). The two layers share a key field for permit IDs (one field is lowercase and the other is uppercase). The Building Permit layer has a field called "Electric Amount." I would like to use a pull function in a survey linked to the Building Inspection layer to populate a question with data from the Electric Amount field if the permitids are found to match. 

I wrote the following pull function to accomplish this, but the data continually fails to populate in the question even after I used a string conversion to handle the integers that are being pulled into a string field. The function doesn't throw any errors in Connect, but it also doesn't pull in any of the desired data when a form is opened.  

string(pulldata("@layer", "ElectricPermit_Amount", "url", "https://services6.arcgis.com/cMgmhwu0L5CeOOoS/arcgis/rest/services/Department_of_Community_Developme...", "where", "PERMITID='${permitid}'"))

I'm all out of ideas on this one. Can anyone tell me where I might be going wrong?

0 Kudos
1 Solution

Accepted Solutions
RobynSnookCCB
Regular Contributor

You don't have the syntax for pulldata correct. This arcticle is super helpful https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-pulldata-quot-laye...

and See the formulas page: https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformformulas.htm

They have examples further down the page as well. I think you'll need getValue for this one. You're pulldata should look closer to:

pulldata("@layer", "getValue", "attributes.permitId","servicesURL", concat("PERMITID='", ${permitid},"'"))

concat is your friend with this one for the where statement. Also many people find it helpful to have the where statement on a different line then the pulldata function, i'd suggest doing that as well with the string aspect of it. For whatever reason it'll just functions better.

View solution in original post

2 Replies
RobynSnookCCB
Regular Contributor

You don't have the syntax for pulldata correct. This arcticle is super helpful https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-pulldata-quot-laye...

and See the formulas page: https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformformulas.htm

They have examples further down the page as well. I think you'll need getValue for this one. You're pulldata should look closer to:

pulldata("@layer", "getValue", "attributes.permitId","servicesURL", concat("PERMITID='", ${permitid},"'"))

concat is your friend with this one for the where statement. Also many people find it helpful to have the where statement on a different line then the pulldata function, i'd suggest doing that as well with the string aspect of it. For whatever reason it'll just functions better.

Marc_Patti
Occasional Contributor

Ugh, you're right. My syntax was all off. I re-worked the function according to your specs and it did end up working.

That Tips & Tricks section for Survey123 was a great resource too. Thanks for all your help!