I have been trying to figure out how to compare date fields in LiveCycle Designer ES2.
I have two date fields: "First Draft Due" and "Final Due"
On exit from Final Due I want to automatically compare the fields. If they are less than 48 hours apart, I want to make the word "Rush" appear at the top of the form.
I have a hidden SubForm "RUSH" at the top of the form.
Any help would be greatly appreciated.
Thanks.
Hi,
assuming you have 2 date fields (DateField1 and DateField2) you can use the following FormCalc script in DateField2 exit event.
if (not $.isNull and not DateField1.isNull) then
var dateFmt = "MM/DD/YYYY"
var firstDate = Date2Num(DateField1.formattedValue, dateFmt)
var finalDate = Date2Num($.formattedValue, dateFmt)
if (Abs(finalDate - firstDate) le 2) then
RUSH.presence = "visible"
else
RUSH.presence = "hidden"
endif
endif
Radzmar:
Thank you for the script. However, I am not able to get it to work, and I am not sure why.
This is the complete script that I put in the exit event for DateDue:
if (not $.isNull and not DateSubmitted.isNull) then
var dateFmt = "MM/DD/YYYY"
var firstDate = Date2Num(DateSubmitted.formattedValue,dateFmt)
var finalDate = Date2Num($.formattedValue, dateFmt)
if (Abs(finalDate - firstDate) le 2) then
RUSH.presence = "visible"
else
RUSH.presence = "hidden"
endif
endif
At first I thought it might be missing some further detail for the fields since they are inside a subform, so I added "GRAPHICREQFORM.GENERALINFO." in front of "DateSubmitted" and "RUSH"
That did not work.
Then I tried using "<=" instead of "le", and that did not work, either.
I am sorry, but my knowledge of javascript is limited and I am not sure if I am overlooking something obvious.
Any further help you can provide would be greatly appreciated.
Thank you.
Views
Replies
Total Likes
The script is NOT JavaScript but FormCalc. Make sure to have selected the correct language.
Views
Replies
Total Likes
Well, that explains a lot, doesn't it?
I made the change, and it is working fine.
Thanks again.
Bob
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies