Level 1

0% to

Level 2

Tip /

to gain points, level up, and earn exciting badges like the new
Mission!

View all

## Calculate end date based on drop-down list

Level 2

I have a drop-down list with 8 programmes that the company is providing, two date/time fields called StartDate and EndDate. I have the following scripts but it doesn't work. Can you take a look and point out where I got wrong please? Many thanks

form1.#subform[0].StartDate::exit - (FormCalc, client)

var date = Date2Num(StartDate.formattedValue,"DD/MM/YYYY")
var value = Programs.boundItem(xfa.event.newText)
if (value == "1") then
EndDate.formattedValue = Num2Date(date + 548,"DD/MM/YYYY") else

if (value == "2") then

EndDate.formattedValue = Num2Date(date+457,"DD/MM/YYYY") else

if (value == "3") then
EndDate.formattedValue = Num2Date(date + 548,"DD/MM/YYYY") else

if (value == "4") then

EndDate.formattedValue = Num2Date(date+457,"DD/MM/YYYY") else

if (value == "5") then
EndDate.formattedValue = Num2Date(date + 548,"DD/MM/YYYY") else

if (value == "6") then

EndDate.formattedValue = Num2Date(date+457,"DD/MM/YYYY") else

if (value == "7") then
EndDate.formattedValue = Num2Date(date + 639,"DD/MM/YYYY") else

if (value == "8") then

EndDate.formattedValue = Num2Date(date+548,"DD/MM/YYYY")

endif

0 Replies