Select to view content in your preferred language

How to pull the latest record from a related view layer using pulldata("@layer") in Survey123(based on staff name)

56
1
yesterday
hmorgan
New Contributor

Hi everyone,

I’m working on a Survey123 Connect project that involves two linked view layers created from one main feature layer.

  • Main feature layer: Best_Staff_Management_Collation

  • HR view layer: used by the HR team to enter staff performance data each quarter.

    • Important field: Percentage_Score

  • GM view layer: used by the GM team to enter their own data each quarter for each staff.

    • In this form, I want to automatically pull the latest Percentage_Score from the HR view layer for that staff.

Each HR record includes:

  • Name — staff name

  • Percentage_Score — quarterly performance result

  • CreationDate — (system field that captures when the record was created)

 

This is my expression, but it is not pulling the lastest record for quarter 3 : pulldata("@layer","getValue","attributes.Percentage_Score","https://services1.arcgis.com/m9p5y180BqMf6JT7/arcgis/rest/services/Best_Staff_Management_Collation_3...", concat("Name='", ${Name},"'"))

0 Kudos
1 Reply
DougBrowning
MVP Esteemed Contributor

To get the latest you would add a SQL query.  See this post  https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-pulldata-quot-laye...

and this one https://community.esri.com/t5/arcgis-survey123-questions/is-it-possible-within-a-survey123-smart-for... 

Something like orderby may be what you want
pulldata("@layer", "getRecord","<your_featurelayer_url>?orderByFields=CreationDate DESC", "1=1")

Hope that helps

0 Kudos