pulldata("@layer") and multiple records.

1168
5
12-22-2022 10:53 AM
durus5995
New Contributor II

I know this is something that just came out a month or two ago but, I just recently came across this blog post about using pulldata("@layer") and I was curious what happens when the getRecord parameter would possibly return more than one record?

https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-pulldata-quot-laye...

 

The use case I am experimenting with is we have service requests that technicians go out to peoples properties and do inspections.  I was looking at the "Calculate values using an attribute query" example and I wanted to do a query that would grab the last record and prepopulate some attributes in a new survey.  I was thinking about using the address of the property but that would return multiple records when there have been multiple inspections at property.  Is there a way to limit the getRecord parameter to just the last record and to ignore the others? 

The way the data is structured I cant think of any other attributes that would be unique to the resident other than their phone number.  But the way people change their phone numbers vs. the land line days could lead to some issues.  I am open to any suggestions or ideas and I appreciate your time.

0 Kudos
5 Replies
ZacharySutherby
Esri Regular Contributor

Hello @durus5995

Pulldata('@layer') will always return 1 record in the scenario where we want just the last record you can use the orderByFields URL parameter to order by creation date. For example orderByFields=creation_date DESC. Please check out the Query a Feature Layer sample in Connect for an example on how to append additional URL parameters when using pulldata('@layer'). 

Thank you,
Zach
0 Kudos
KevinNoelUWI2022
New Contributor

I've been working with the pulldata @layer, but it returns nothing,  the layer is shared publicly, the url is correct i get no error on the syntax of the calculations, what am i doing wrong ? 

0 Kudos
ChelseaRozek
MVP Regular Contributor

@KevinNoelUWI2022 what's the full pulldata expression you're using?

0 Kudos
ChelseaRozek
MVP Regular Contributor

Hi @ZacharySutherby, if you use the distance parameter (which normally returns all within that distance), does it return the closest feature? Or is there some way to sort this as it's not a field in the dataset?

0 Kudos
LouisDECOMBE
Occasional Contributor

Hi @ZacharySutherby , is here a way to return many record that respect where query? i'de like to show in 123survey notefield all records that match a sql query with pulldata .

 

Thank you

0 Kudos