Fix a serial number based on data and time

Hi all
Can someone help me? Thanks in advance.
We are surveying an otter population in Spain. We survey looking for sings of activity (foodprints and scats).
We designed a form to create a unique serial number based on date and time each time we find a otter scat.
Each time we found a scat, we collect it from the field and put it inside a plastic bag and identify the bag with that unique serial number. In that way, We can relate the data obtained from the scat analysis with the habitat and GPS location where the scat was collected.
To create the unique serial number we use the following calculation formula:
concat(substr(today(),0,4),substr(today(),5,7),substr(today(),8,10),substr(now(),11,13),substr(now(),14,16),substr(now(),17,19),’/’,${transect},’/’,${User})
Which give us the following result
20211008180658/transect1/Angel (wich means: scat found 0221/10/08 at 18:06_58 in the transect 1 by Angel)
That works fine in the field most of the time. But, if for any reason we have to edit a record (in the field or even in the laptop) with the button β€œGo back”, the part of the serial number based in datae and time change to reflect the time of the edition, so, in that cases we can’t relate anymore the data and the location.

The answer now is: Are there any ways to fix a serial number based on data and time to reflect the time at which the scat was collected, instead of the time when the record was edited?
And, is there any way to count the otter excrement, collected, and this value to the serial number (resulting in 20211008180658/transect1/Angel/1)?

Thanks very much in advance, and sorry by my English

Hi @AngelSS, your first question should be solved through the use of once() around your calculation. I.e.:

once(concat(substr(today(),0,4),substr(today(),5,7),substr(today(),8,10),substr(now(),11,13),substr(now(),14,16),substr(now(),17,19),’/’,${transect},’/’,${User}))
1 Like

Regarding your second question, is the count you are wanting across submissions or within a single submission? (Maybe just explain a bit more where they count comes from)

1 Like

Thanks very much Josh.

Your first answer will help us a lot. With this solution the serial number will be solved.

Thanks very much

2 Likes

Hello @AngelSS,
Using the search function of this forum often helps a lot, e.g.
https://community.kobotoolbox.org/search?context=topic&context_id=23356&q=unique%20serial%20number&skip_context=true

2 Likes