Avatar

Level 2

Take a look at this answer I gave another person about adding days to dates: Re: Adding Days to a Date​.

So, depending on whatever value the user picks from the radio button (90, 180, 365), add that number to a periodSelect variable, then run a  Num2Date call to set the value of the newDate field.  The example below presumes you have a radio button called radioButton1 with default button values of '0' for 90 days, '1' for 180 days, and '2' for 365 days.

Example:

var periodSelect

var newDate_Num

if (radioButton1.rawValue == "1") then

    periodSelect = 180

elseif (radioButton1.rawValue == "2") then

    periodSelect = 365

else

    periodSelect = 90

endif

newDate_Num = Date2Num(Start_Date.formattedValue, "YY/DD/YYYY") + periodSelect

newDate.rawValue = Num2Date(newDate_Num, "YY/DD/YYYY")

Caveat to using .rawValue versus .formattedValue when it comes to date fields (something I had to figure out/learn on my own the hard way): .rawValue will be zero if the user clicks in the date field and picks via the drop-down calendar rather than types it in.  My best guess is that happens because the calendar drop-down box mouseclick isn't a date, but a window coordinate that the subroutine has to convert into a date for the .formattedValue.

Hope this helps.

- Kaye