Select to view content in your preferred language

Autpopulate field based on corresponding attribute from online feature layer provided in select_one search function

2818
4
Jump to solution
01-27-2022 09:46 AM
HeatherBell
Frequent Contributor

Here is an outline of what I am trying to do in Survery123, but I reached a bit of a blocker at step 2.

Users:

Step 1 (done). Select their project name ('projectname') from a autocomplete select_one search function which gets data from an online feature layer. Done, see:

autocomplete search('findprojectname?url=https://services3.arcgis.com/Bb8lfThdhugyc4G3/arcgis/rest/services/service_4dc0ba5a63a041f1a474aa960...', 'projectname')

Step 2 (stuck) Search or pulldata from the same online feature layer to get the corresponding project code (called 'unique_ID') for the matching project name ('projectname') which they entered in step 1. Not sure if this is done through search under appearances or a calculation I've tried both and ot hasn't worked.

Step 3 (done) Concatenate the project code ('unique_ID') with today's date that is generated by using the now function to get an individual asset  ID code which is read only. Done - see: concat(${'unique_ID'},"_",format-date(now(), '%y%m%d%H%M'))

 

I want them to have the option of using the project name which is more memorable to aquire the project code which will be less memorable. To make the survey more user friendly. 

Thank you, hope someone can help. 

Best wishes, 

Heather. 

GIS Analyst @ The Rivers Trust
0 Kudos
1 Solution

Accepted Solutions
HeatherBell
Frequent Contributor

I have managed to create a solution using the following in the appearances tab. However, it's a not a perfect solution as the user still needs to select the unique ID, even though only one option is available. Then the survey concatenates the values into one attribute code which contains the parent project code. I think a better solution will be possible using a pulldata function through javascript however, this isn't possible when sharing the survey to public at the moment. See post here for the solution that works for forms only shared within organisation. I've attached the search apperance solution example below as a spreadsheet. 

autocomplete search('findcode?url=replacewithserviceurlxxx/FeatureServer/0', 'matches', 'projectname', ${projectname}, 'uniqueID')

GIS Analyst @ The Rivers Trust

View solution in original post

4 Replies
DerrickWestoby
Frequent Contributor

This is 100% a shot in the dark since I haven't used a hosted feature layer with search() yet, but is it possible that your query isn't working because you need to URLencode the ${projectname} first?  

0 Kudos
HeatherBell
Frequent Contributor

I have managed to create a solution using the following in the appearances tab. However, it's a not a perfect solution as the user still needs to select the unique ID, even though only one option is available. Then the survey concatenates the values into one attribute code which contains the parent project code. I think a better solution will be possible using a pulldata function through javascript however, this isn't possible when sharing the survey to public at the moment. See post here for the solution that works for forms only shared within organisation. I've attached the search apperance solution example below as a spreadsheet. 

autocomplete search('findcode?url=replacewithserviceurlxxx/FeatureServer/0', 'matches', 'projectname', ${projectname}, 'uniqueID')

GIS Analyst @ The Rivers Trust
ahargreaves_FW
Frequent Contributor

@HeatherBell this was helpful, thanks. I have the exact same issue:

  • Use a GeoShape to draw on a map and grab an intersecting point's ID
  • Thanks to you I can now automatically submit that ID into a second search a pull back a second attribute for the matching record.
  • However, in order to be able to actually use that second attribute the select_one must be selected by the user....

@IsmaelChivite , @JamesTedrick , @ZacharySutherby , @BrettStokes , @Shwu-jingJeng   is there any way around this?

ahargreaves_FW_0-1670371848369.png

 

Sharouff
Occasional Contributor

I am using the autocomplete search appearance to reference a dynamic hosted feature layer view where the user selects the last report number used in order to generate the next sequential number. I am trying to show the values in descending order but haven't found a solution. Latest expression = autocomplete search('FireId?url=https://services6.arcgis.com/iQxzOWEp1MXm2FTa/arcgis/rest/services/EFire2_Training_Fall23/FeatureSer...', 'matches', 'DOF_District', ${DOF_District}, 'orderByFields=RegionFireID, DESC') and I've tried a dozen other configurations with no luck and still get the list in ascending order (see screenshot). It does provide a filtered list based on the region but my user have to scroll to select the last number used. This is a text field so that might be the issue? Anyone have a possible solution for descending order list?

0 Kudos