Hi all,
I have an application where I need users to input data sequentially every time a new unit is added to the system. Prepopulating answers doesn't work, because the user input number has to be a new unique value. So I'm just trying to make a list of old answers for review by the user to input the next value sequentially.
I'm essentially looking to be able to use the search() or pulldata() function in a note. I was hoping that someone out there might know of a solution.
Thanks,
Matt
Hello @MattTarkington1,
The search() appearance wouldn't be ideal for this workflow as it's intended for select_one or select_multiple question types.
You can use a pulldata("@javascript") function to query the feature service and return the unit ID's present in the feature service.
With that information you could prepopulate the answer as you can sort the unit ID's and add one to the highest value.
Please see this Esri Community article for more information on using JavaScript functions.
Although I would recommend either using the Object ID or post processing the data to insert the unit ID as entering it in the survey could cause duplicate ID's. For example say a JavaScript function returns the list of ID's and it's up to the survey responder to add the next sequential ID, if multiple survey responders open the survey before another one submits they will each see the same ID as the last ID and will each enter the next sequential number. This would cause an issue if say Bob opened the survey and saw the list of ID's ended at 10, Bob then enters 11 and starts filling out his form, then 2 minutes later I open the form if Bob doesn't submit before I open the form I will also see the list of ID's end at 10 so I will also enter 11. When Bob and I both submit we will both have the same unit ID.
Using the Object ID or post processing the data will ensure that each record in the sequence is unique.
Thank you for replying Zach,
I've gone with using the ObjectID, simplest easiest way to work this. I really appreciated the advice.
However, I think I still have a use case. I have a survey for vendors to register vehicles, and some of these vendors have more than one vehicle. I'm looking for a way to show previous answers (ideally selectable) so that if the form gets filled out twice I don't end up with "Roses Roses" and "RosesRoses" for the same vendor. At the same time, if the vendor is new, and hasn't filled out the survey before, they still have the option to input their name. Kind of like how excel reviews value's in the column above and populates value's as you type.
I have this worked out using two fields, but that leaves room for user error.
Thanks,
Matt