Calculate end date from start date and radio button values


using formcalc, wish calculate user entered start date, adding 90, 180 or 365 days get end date. using radio buttons 90, 180 , 365 days.  far have this:

 

 

(radiobutton.rawvalue==1)//radio button bound 1 on/yes then;//

 

, have this:

 

 

current=date2num(start_date.rawvalue,"mm/dd/yyyy")

future=current+90

newdate=num2date(future,"mm/dd/yyyy")

 

= newdate

 

but don't know how put them or incorporate 180 , 365 days.  know second part works because use it, far have gotten.

 

any help/suggestions appreciated!!!

 

thanks,

 

lou johnson

 

 

take @ answer gave person adding days dates: re: adding days date.

 

so, depending on whatever value user picks radio button (90, 180, 365), add number periodselect variable, run a  num2date call set value of newdate field.  example below presumes have radio button called radiobutton1 default button values of '0' 90 days, '1' 180 days, , '2' 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 using .rawvalue versus .formattedvalue when comes date fields (something had figure out/learn on own hard way): .rawvalue 0 if user clicks in date field , picks via drop-down calendar rather types in.  best guess happens because calendar drop-down box mouseclick isn't date, window coordinate subroutine has convert date .formattedvalue.

 

hope helps.

 

- kaye



More discussions in LiveCycle Forms


adobe

Comments

Popular posts from this blog

Reader DC

AdobeIDの作り方

Adobe InDesign CC 2017 has stopped working