I have a Repeat where you input a plant species. Each entered species goes on a new repeat. I am pulling the species data from an external csv file (there are 1700 species). This works, however, if I have say 5 different plant species and I want to scroll back to a previous entry, the species choice is blank as the calculation for that choose one is performing the pulldata from the csv file and it doesn't recall the entry that was originally submitted.
Is there any way that I can keep the species that were entered so that I don't have to re-enter the value each time, I just want to scroll through the repeat to see what I have previously entered.
I don't want to enter the 1700 records into the choices on the xlsform as this is a living document that changes often and contains other columns of information that I am also pulling into the form.
Solved! Go to Solution.
That makes sense. But then you'd want a choice_filter, not a calculate, and I see you also have a choice_filter applied to your common choice list (this wasn't the issue, so I left in the local version I tested - I only deleted the common's calculate).
Really depends on your set-up.
From your description, try setting bind::esri:parameters to calculationMode=whenEmpty for the pulldata() that is resetting. More on calculationMode here.
I tried setting the bind::esri::parameters to calculationMode-whenEmpty, but unfortunately that didn't seem to work.
In my select one I am using this "select_one_from_file sk-taxa-vascularplant-all_revised_Jul18.csv".
I will add the species and then on the repeat, I will add another species. If I go back to the previous input, the dropdown will quickly show what was there, but then go blank as if it cleared out what was there. I have attached the xlsform and the csv file from the media folder for reference.
Ah. The issue is likely related to the interaction between lifeform and common. common has a calculate reading lifeform.
What is the purpose of pulldata('sk-taxa-vascularplant-all_revised_Jul18', '', 'lifeform', ${lifeform})?
Deleting the calculate attached to common fixes the issue (buy may create a new issue, depending on your intent).
EDIT: Hello from Alberta fellow Prairies prov!
Greetings from Saskatchewan!
Yes, to answer your question:
Because there are over 1700 species in the csv file, we broke them down to 4 possible lifeforms (Graminoid, Forb, Shrubs, Trees) so when selecting one of these 4, it will narrow down the species list making it much more palatable to scroll through the possible list of species. It's what worked at the time, but maybe there is a different way of doing that.
That makes sense. But then you'd want a choice_filter, not a calculate, and I see you also have a choice_filter applied to your common choice list (this wasn't the issue, so I left in the local version I tested - I only deleted the common's calculate).
Hi again @abureaux, I'm running into a similar issue in my Survey123 form and I'm wondering if you could help me out.
I have a field that runs a pulldata(@layer...) calculation to query itself to retrieve asset information from past inspections using a unique barcode. If the item has never been inspected, the inspector is assigning the item a barcode and manually entering in the asset info for the first time. This seems to work fine until they start trying to scroll backwards through repeats. Once they do that it starts deleting contents of these previously entered fields.
What I think is happening is that the pulldata(@layer) calculation is running again and since that information does not exist in the layer yet, it is replacing that manually entered data with null values.
I have tried several things to fix this. I moved the pulldata calculation into another field and coalesced into the final field, but this doesn't seem to help. I've also tried calculationMode=whenEmpty and this seems to work for the first repeat, but then the pulldata(@layer) doesn't fire at all on every subsequent repeat in the form unless the user manually presses the recalculation button (is that normal behavior?). I've also tried wrapping the pulldata(@layer) in once(), which does seem to help, but then if the user enters/scans the wrong barcode and wants to input a different one the other fields are not being refreshed.
I feel like there is a solution here somewhere for what I'm trying to do and I'm pulling my hair out trying to find it.
Anyway, I'll attach the CSV. The problem rows are 46-57.