Hi, I have a bizarre problem concerning the dateAddMonths runtime function in a calculated field. I have a date field which is called HB-EffectiveDate and that sets the start date. I want a second date to be calculated based upon HB-Duration, a text box (set as integer), whereby the resulting date should be: HB-EffectiveDate + number of months set by varDuration (which is basically HB-Duration).
There is a checkbox HB-SinglePayment-YN, that determines if there a single payment (i.e. no months to add). So, when checked it will just return the same as HB-EffectiveDate. The formula I have for this in the calculated field is:
Â
If(HB-SinglePayment-YN==True,formatDate(HB-EffectiveDate,"dd/MM/yyyy"),formatDate(dateAddDays(HB-EffectiveDate,varDuration),"dd/MM/yyyy"))
Â
However, the value shown in the calculated field is completely erratic. Just adding 1 into HB-Duration sends the calculated date from 01/09/2021 to 01/10/2027, so it seems to be adding a magnitude of months instead of just 1.
I have run out of ideas. Can anyone help?