Add 90 minutes into a coputed field

Hello,
I am facing this issue.

There is a field called “Pristi terapie”" (date + time). I would like to create a computed field that adds 90 minutes (constant) into it.

Example. If field “Pristi terapie” is 25-01-2025, 9am, then the computed filed should be calculated to 25-01-2025, 10:30 am.

I am not a JAVA script guy so I asked chat GPT for help. It proposed folowing structure:
new Date(Date.parse( Pristi terapie) + 90 * 60 * 1000)

I used it in Tabidoo, but I was not successful:

  1. The system says that the formula is valid, BUT
  2. The system does not save it an displayes an error message.

See attached screenshot

Would you please advise?

Many thanks,
Ladislav

ChatGPT is correct, but in auto fields it is not that evident :slight_smile:

There are some methods in the Autofields, but only ADDDAYS I think not, hours, and I don’t even want to try that.

Personally I would try to go with JS anyway.

  • The “Date.parse(yourvalue)” => express your date value in miliseconds,
  • “+ 90 * 60 * 1000” is just so you can easily change it. it adds 90 times 60 seconds expressed in miliseconds.
  • new Date ( ) => reverts your result in miliseconds back to a date.
    So to put that in your field you can do "doo.model.yourfield.setValue();

Create a new field → select button and give it a name. → In script you can put then in one line:
doo.model.yourField.setValue(new Date(Date.parse(doo.model.startDate.value) + 90 * 60 * 1000));

To fill in “yourField” and “startDate” you have to find the respective Field internal names in your system.

Once this works with the button you can let the field be filled in automatically on change, but for that is best to add some checks in to not throw errors to your users.

With tabidoo and some AI learning goes really fast :wink:

Success!