Code snip from Unique Serial Numbers doc page is not working as expected

Hello, the code snippet concat(substr(today(), 0, 4), substr(today(), 7, 5), substr(today(), 10, 8), substr(now(), 13, 11), substr(now(), 16, 14), substr(now(), 19, 17)) from Creating Unique Serial Numbers in Forms — KoboToolbox documentation is not working as expected.

The doc page shows in the example a long serial number being generated by the snippet but when i tried it on my private server it only showed me the number “2023”.

I then went and tried it on a kf.kobotoolbox.org server to test if the issue had to do with my own installation but on the kf server it also had the same results.

To reproduce it just follow the instructions in the doc and instead of getting a long unique serial number like pictures show it will instead only show the number 2023.

Wasn’t sure if i should had tagged the post as a bug or support so apologies in advance if i did it the wrong way.

Thank you for bringing this to the community, @jamdumdum12! Seems like it’s time to update our article.

1 Like

See correct syntax/argument order here ODK XForms Specification “Returns the substring beginning at the specified 0-based start index and extends to the character at end index - 1.”

Concerning now(), also check this issue, please. (@Kal_Lam)

You may also use uuid() function instead: ODK XForms Specification

1 Like