These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Entering Dates

koenigma
Registered: Jan 23 2008
Posts: 45

I would like to thank those who replied to my previous posting regarding calculating dates. Based on those replies perhaps I did not explain well what the problem is that I have.

As in my previous postingI created an expense report form which povides space for up to 14 days, with 2 calendars to indicate the period covered`(e.g. Starting Date % Ending Date).

What I would like to do, is that based upon the Start & End Date, the individual dates are entered at the top of each column.

With FormCalc I have entered the following code:
-------------------
"Date1:calculate"
-------------------
// Check that Starting Date and Ending Date are not empty
if (HasValue(StartDate) & HasValue(EndDate)) then

// Enter the Starting Date as the heading of the 1st column based on the StartDate & EndDate
Date1.formattedValue = Num2Date( Date2Num(StartDate.formattedValue, "MMM. D, YY"), "MM/DD/YY")

else

// Clear Field
Date1.formattedValue = ""
endif

-------------------
"Date:2calculate"
-------------------
// Check that Starting Date and Ending Date are not empty
if (HasValue(StartDate) & HasValue(EndDate)) then

// When the Ending Date is > then the Starting Date complete date in 2nd column by adding + 1 to Starting Date
Date2.formattedValue = Num2Date( Date2Num(StartDate.formattedValue, "MMM. DD, YY") + 1, "MM/DD/YY")

else

// Clear Field
Date2.formattedValue = ""

-------------------
"Date3:calculate"
-------------------
// Check that Starting Date and Ending Date are not empty
if (HasValue(StartDate) & HasValue(EndDate)) then

// When the Ending Date is > then the Starting Date complete date in 3rd column by adding + 2 to Starting Date
Date3.formattedValue = Num2Date( Date2Num(StartDate.formattedValue, "MMM. DD, YY") + 2, "MM/DD/YY")

else

// Clear Field
Date3.formattedValue = ""

etc....... until "Date14"

The problem I have is that all the columns are being completed regardless what the End Date is.

Any help, on how I would have to modify my code so that only dates from starting date to ending date are completed and the other column remain blank. would be appricated.
Martin

My Product Information:
LiveCycle Designer, Windows
pforms
Registered: Nov 17 2009
Posts: 87
I'm confused. How many columns do you have? I'm assuming 14 and that the expense report always requires a 14 day period. One column for each day. Which column do you not want to populate?

Or is it that the expense report doesn't always require 14 days. For instance you only want to submit 2 days of expenses and you only want those two days on the form?
koenigma
Registered: Jan 23 2008
Posts: 45
The report has space for up to 14 days but it might only cover 2 days.