Besvart

Refresh time generated by NOW()

My use case is that depending on the current time, certain fields should be shown or hidden. I've got a time field that generates 24 hour time as a single number:

FORMAT-DATE(now(), 'Hm')

  This formula is in a hidden field called {{currentTime}} and that allows me to create formulas to calculate if the current time is past a certain time: 

{{currentTime}} < 1730

 The trouble is that this time seems to be set when the form is first started, and if it's been a while since first opening the form by the time the step is triggered that uses the time, it could generate the wrong response (e.g. form started at 1725, and ten minutes later it's past 1730 but it will still trigger the 1730 condition.


Is there some way I can force this time to be generated at a certain point in the form so I know it's the current device time not the time that the form was first opened?

  • Can you try this? Use a trigger for the now() calc. Make it a field that the user has to fill out, and then base the calculation off it, like this:

    IF(NOTBLANK({{timeTrigger}}),FORMAT-DATE(now(), 'Hm'),'')

    Then it's based on the time the user last entered data into that field and not when the form is opened :)


    1 person liker dette
  • This is a great solution! Thank you very much.

Logg inn eller Registrér publiser en kommentar