Bring response from outside a repeat inside the repeat so I can be used in dateTime calculation.

151
3
06-15-2021 08:57 AM
HowardWilliams1
New Contributor

In my survey, my first question records the date and time via a dateTime question type.  Later in the survey I start a repeat.  In that repeat I generate a unique ID that includes the date and time.  I attempted to use a calculate question type  to modify the date and time to the desired format.  To do that I called the dateTime question and requested to print certain elements.  What I discovered is that inside the repeat statement, the dateTime question is not referenceable.  My solution was to add another hidden dateTime question with the default set to now() inside the repeat.  This worked for my calculation however, this not the desired time stamp.

So, how do I reference the response from a previous question outside a repeat inside the repeat? 

Thanks for you thoughts.

0 Kudos
3 Replies
DougBrowning
MVP Frequent Contributor

Just tested and it works fine.  Something else is going on can you post the form?

see attached

0 Kudos
HowardWilliams1
New Contributor

Thanks for your help.  

0 Kudos
DougBrowning
MVP Frequent Contributor

I changed line 65 calc to concat('G',${sam_dat},${fis_num}) and it works fine.  I also tried concat('G',format-date(${sam_dat},'%Y%m%d%H%M'),${fis_num}) and that works also.

DougBrowning_0-1623782467474.png

 

Not seeing anything that does not work.

I did see that you must be using CtrlC CtrlV from another excel sheet. That will mess up all the drop downs in 123.  Make sure to use right click paste values instead.

Also why do you need a unique key?  Not sure why you would.  You could use uuid() also and it will generate one for you.

Need more info on what does not work.  Attached changes

0 Kudos