Date calculations

Discussion, questions and support.
Post Reply
abg0201
Posts: 13
Joined: Dec 25th, ’23, 09:00

Post by abg0201 » Dec 25th, ’23, 09:08

Hi all, I am new to this software and am still learning, however I am struggling to achieve a calculation using dates.

I am writing patient notes and would like to have a date picker with a calculation of days elapsed eg:

"Onset of illness {date picker} - unwell for {calculation today-date selected} 7 days"

Please can anyone advise how to go about this?

Many thanks

Andy.
User avatar
Tom
Posts: 917
Joined: Nov 24th, ’15, 23:39

Post by Tom » Dec 28th, ’23, 18:38

To pick a date, use Selection Form macro, Type: DateTime.
To write a calculated date (from today), use Date and Time macro.

To pick a date and then perform the maths on it, you need a script. It depends on the date format you are using in Selection Form macro - let me know and I will try to create it for you.
abg0201
Posts: 13
Joined: Dec 25th, ’23, 09:00

Post by abg0201 » Dec 29th, ’23, 07:07

Tom wrote: Dec 28th, ’23, 18:38 To pick a date, use Selection Form macro, Type: DateTime.
To write a calculated date (from today), use Date and Time macro.

To pick a date and then perform the maths on it, you need a script. It depends on the date format you are using in Selection Form macro - let me know and I will try to create it for you.
Thanks Tom, that's really generous of you. I use the British date format of dd/mm/yyyy.

Andy.
User avatar
Tom
Posts: 917
Joined: Nov 24th, ’15, 23:39

Post by Tom » Dec 30th, ’23, 13:17

1. Selection Form macro, Name: MyDate, Type: DateTime, Format: dd/MM/yyyy, No output
2. Insert Command Code macro:

Code: Select all

StringSplit, COL, SELECT_MyDate, /
Date:=COL3 COL2 COL1
Date += 7, Days
FormatTime, Date, %Date%, dd/MM/yyyy 
Send, % Date 
abg0201
Posts: 13
Joined: Dec 25th, ’23, 09:00

Post by abg0201 » Dec 31st, ’23, 08:15

Great, thanks very much Tom, excited to try this out!
Post Reply