Entities / Problem to display entities'values as default values

1. What is the issue? Please be detailed.

The form allows to locate and describe piles of litter (composition, hight, length etc...) and to indicate the actions to be planned or carried out (I know... This is a very exciting and fascinating subject! ;-)).

Those informations are registered as entities and I would like to re-use entities'values as default values when selecting an existing pile to allow colleagues to see them and modify them if needed.

I tried as indicated in the documentation (formula in calculation + trigger), but it worked only for one column (a select_one type named type_depot) and not for others I tested (date and decimal types).

3. What have you tried to fix the issue?

To check the syntax, we created "calculate" questions for two of them (date_mise_a_jour and longueur) and it found the right values (presents in the submissions file). So at first glance, it's not a syntax error.

Just in case, I also tried to put the formula in the default question, but without success.

4. Upload any forms or screenshots you can share publicly below.

Here is :

I hope I haven't missed an existing post on this subject. :slight_smile:

Thank you for your help.

Just to check - are you testing a draft or published and is it linked to an entity list or are you using the CSV? As draft forms can read entity lists but not write to them. And the difference between an entity list and a CSV is they call name __id.

Testing your form (as a draft, with the CSV), it doesn't work properly initially, but changing the first column name from __id to name then lets it work properly, and it does preload type de depot / longueur / largeur / hauteur all correctly. It didn't load date de mise a jour but the CSV was blank for these - editing it to add dates caused it to preload this properly as well.

Your form looks fine to me, it seems to be a CSV vs entity list use issue.

Hi Andrew,

We are testing a published form and yes, it is linked to an entity list and not a "simple" csv. I exported the entity list as a csv because I though it may be useful not to start with an empty list.

@nathalie_H Hi Nathalie! One thing I'm noticing is that the date data is in a format that I don't think works with XForms (dd/mm/yyyy).

I've tried switching the dates to ISO 8601 (yyyy-mm-dd) and the things seem to work better. Could you give that a try and let us know if that fixes things?

did you open the CSV in excel or similar and let it reformat the data to your locale? (this happens to me, it shows as d/m/y)

when I look at the raw CSV I see it as 8601 already:
image

(this does remind me I still owe the forum a big date/time/datetime comparison in lookups / defaults / date math / choice vs CSV vs entity across collect/WF/Enketo as I also hit some hurdles there before)

I published your form and uploaded the content of depots_dechets_referentiel.csv to the entity list - the form still worked fine in Enketo and Web Forms - selecting one of the existing entities preloaded date/type/dimensions with no problems, adding a new location also created an entity with no problems, and it was selectable in the next submission.

Hi Callum, hi Andrew,

In the csv, the date data format is OK for me.

Since the last "real" corrections we made (on the formula), we have only tested the form with ODK Forms.

After reading your last posts, @ahblake, I tested on my phone and everything was working fine (:flushed_face:) but it was still the same on ODK Web Forms.

We checked our version of Central. We were late from one release so Mathieu updated Central and (drum rolls :drum: )... erverything works!

Thank you very much for the time you spent to help us... and sorry!

But in my defence, it was my boss (@mathieubossaert ) who insisted that I use ODK Web Form instead of a phone. :zany_face:

And after this shameful denunciation, I think I'll have to give up on my next salary increase.

Great spot Andrew! We had a project setup with the data on one our test servers which I didn't set up myself, but I'm guessing the data got "corrupted" by something.