Dear Open Foris team, I have a survey where I create a unique code based on the concatenation of the date and time. date_indiv: default value = idm:currentDate() time_indiv: default value = idm:currentTime() code: default value = concat(date_indiv,"-",time_indiv)

How can I modify my expression to obtain a code which includes "0", for example "0912" for 9h12: thus "20200604-0912". My current expression gives me "20200604-912"; so it seems to do it automatically for the date but not for the time.

Thanks a lot in advance, Bruno

asked 04 Jun '20, 07:23

bsenterre's gravatar image

bsenterre
101518
accept rate: 0%


Hello,

For the same question I used the nexts expressions in the default value:

concat(substring(date,3,6),"_",time) apply when time>=1000;

concat(substring(date,3,6), "_0",time) apply when time>=100;

concat(substring(date,3,6), "_00",time) apply when time>=10;

where date is a field with default expression idm:currentDate() and time with idm:currentTime()

LluĂ­s

permanent link

answered 04 Jun '20, 07:47

lcomas's gravatar image

lcomas
115
accept rate: 0%

Thanks a lot for your speedy reply. It worked. Best wishes, Bruno

permanent link

answered 05 Jun '20, 10:49

bsenterre's gravatar image

bsenterre
101518
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×493

question asked: 04 Jun '20, 07:23

question was seen: 2,186 times

last updated: 05 Jun '20, 10:49