Pulldata - multiple clients history

341
1
02-08-2023 11:03 AM
RyanOLeary
New Contributor

Hi,

I'm wondering if someone can help with this challenge... For context, we are trying to capture client history in Survey #1. This first survey captures services and referrals for that client and is fairly straightforward. Later on, their needs to be a follow-up survey to capture the attainment of the referral process. I've created Survey #2 to do that by pulling data from the layer of Survey #1 using a "client search" for the look-up in that layer. This then populates the referral history and gives some follow up questions.

However, my big problem is a client could be entered into Survey #1 multiple times, but Survey #2 will only search and pull in data for the first record in that layer. Is there a way to pull multiple records from the layer of Survey #1? Or is there another creative way to accomplish this?

I'll give an example - Bob Smith is entered into Survey #1 and referred for metal health. He goes and attains the mental health referral and the org follows up with him in Survey #2, finds him, and marks his mental health referral as attained.... 3 months later Bob Smith is encountered again for Survey #1 and he needs a housing referral. Bob Smith attains that referral and Survey #2 is used... but since this is the second record for Bob Smith in Survey #1, only his first mental health record is pulled into Survey #2. I hope that helps give an idea of what I'm trying to accomplish.

Tags (1)
0 Kudos
1 Reply
ZacharySutherby
Esri Regular Contributor

Hello @RyanOLeary

You can use additional URL parameters in your pulldata(@layer) syntax to specifically pull the most recent record. All pulldata(@layer) does on the back end is query the feature service so you can use the orderByFields parameter to order by the creation date field. So it would look like: 

pulldata("@layer", "getValue", "attributes.SomeAttribute", "<serviceURL>/0?orderByFields=creation_date desc", <whereClause>)

Thank you,
Zach
0 Kudos