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

Adding 30 days to a date in a dynamic LC form.

bjasman
Registered: Apr 6 2010
Posts: 37
Answered

Hello-
I'm working on a dymnamica form that is merged with XML data. In the XML, I get a FirstQuoteDate and bind it to the corresponding field in the form. I then have to calculate the ValidDate by adding 30 days to the FirstQuoteDate and display that date int he Valid Date field.
I've tried several scripts with no luck. Below is the latest script I tried. I also tried the script in several different events. I believe it is the calculate event for the ValidDate field right now. Does anyone know what I am doing wrong?

var QuoteDt = Date2Num(PROPOSAL.Page2Summary.FirstQuoteDate.rawValue, "MM/DD/YY")
var FutureDt = QuoteDt+30
var ValidDt = Num2Date(FutureDt, "MM/DD/YY")

PROPOSAL.Page2Summary.ValidDate.rawValue = ValidDt

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Are you getting any errors?

Exactly where is this script located, form field and action?

Does the 'QuoteDate' field have a value?

George Kaiser

bjasman
Registered: Apr 6 2010
Posts: 37
I'm not getting any errors. The Valid Date just stays blank. The FirstQuoteDate and ValidDate are both Floating Fields in a text box. I have the script in the Calculate Event for the ValidDate field. The QuoteDate does have a value of 06/06/10. I used a message box to test that.
bjasman
Registered: Apr 6 2010
Posts: 37
Actually the FirstQuoteDate displays a value of 06/06/2010 when I preview the form. The ValidDate is empty. No errors.
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Try the following script into the layout:ready event of your ValidDate field:

$ = Num2Date(Date2Num(PROPOSAL.Page2Summary.FirstQuoteDate.formattedValue, "MM/DD/YYYY")  + 30, "MM/DD/YYYY")

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

bjasman
Registered: Apr 6 2010
Posts: 37
Still no luck. I put that script in the layout:ready event of the ValidDate field. When I preivew the form, the FirstQuoteDate has a value of 06/06/2010 but the ValidDate field is empty.
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Did you set the language in the script editor to FormCalc?

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

bjasman
Registered: Apr 6 2010
Posts: 37
No, I did not. I just changed it to FormCalc and it works beautifully now. Thank you sooooo much! I really appreciated your help!