Hi, my appologies if this has been asked. I found a few threads in searching the forums that deal with similar issues, but the solutions didn't help me any so I decided to start a new discussion.
I have a field called date1 and I have a field called rate. Quite simply, all I want to do is determine the default value held in rate based on whether date1 is set prior to 7/1/2011.
Here is what I have tried with no luck.
if (Date2Num(form1.#subform[0].Table1.Row2.date1.formattedValue, "M/D/YYYY") >= "07/01/2011")then
form1.#subform[0].Table1.Row2.rate1.rawValue = .555
else
form1.#subform[0].Table1.Row2.rate1.rawValue = .51
endif
I have also tried several other bits of code, including some java script with no luck. I would have to assume my error is somewhere in the way the field 'compares' the datefield with the value I specify in the formula.
I am a total form newb so I appologize if this comes off a bit ignorant.
Thanks for any help I receive, in advance.
C. S.
Solved! Go to Solution.
The Date2NUm function will return you the number of seconds that have elapsed since the epoch so you will need to compare it to the number of seconds that have elapsed from the epoch for 07/01/2011 ....so
if (Date2Num(form1.#subform[0].Table1.Row2.date1.formattedValue, "MM/DD/YYYY") >= Date2Num("07/01/2011", "MM/DD/YYYY))then
Paul
Views
Replies
Total Likes
Since you are checking the format for 07/01/2011, try changing the format in the function.
if (Date2Num(form1.#subform[0].Table1.Row2.date1.formattedValue, "MM/DD/YYYY") >= "07/01/2011")then
form1.#subform[0].Table1.Row2.rate1.rawValue = .555
else
form1.#subform[0].Table1.Row2.rate1.rawValue = .51
endif
Thanks
Srini
The Date2NUm function will return you the number of seconds that have elapsed since the epoch so you will need to compare it to the number of seconds that have elapsed from the epoch for 07/01/2011 ....so
if (Date2Num(form1.#subform[0].Table1.Row2.date1.formattedValue, "MM/DD/YYYY") >= Date2Num("07/01/2011", "MM/DD/YYYY))then
Paul
Views
Replies
Total Likes
Well, niether of those options seemed to work. I am not getting an script errors with it, but it fails to change the field if I change the date. Here is what I have currently.
if (Date2Num(form1.#subform[0].Table1.Row2.date1.formattedValue, "MM/DD/YYYY") >= Date2Num("07/01/2011", "MM/DD/YYYY"))then
form1.#subform[0].Table1.Row2.rate1.rawValue = .555
else
form1.#subform[0].Table1.Row2.rate1.rawValue = .51 endif
Thanks for the help!
Any other suggestions?
Views
Replies
Total Likes
Syntax seems tobe correct. Can you share your form to have a look at it..
Thanks
Srini
Views
Replies
Total Likes
I'll have to find someplace to host it, I am not familiar with 'sharing' forms other than through webhosting. Let me find someplace I can upload it and then I will post a link.
Thanks!
Views
Replies
Total Likes
Steps to share a document..
1. Go to URL http://Acrobat.com
2. Create an account if you don't have one.
3. Then login to the website.
4. In top left corner you will see a button called Upload.
5. Click on browse and select the file you want to upload.
6. After Uploading, mouse over on the uploaded file. Click the down arrow button and choose Share document.
7. Then you will be prompted a popup window at the lower left corner. Choose "Publish it" option.
8. In the next pop up window choose "Copy Link" option.
9. You can paste the link in the forum thread.
Thanks
Srini
Excellent instructions!!!
Here is is..
https://acrobat.com/#d=15D4Nz4q8Ce7zatQdgUPDQ
I have only started working the formula through on the first table row. It is far from finished layout wise as well. I just like to get the functionality working before making it "pretty".
Let me know what I did wrong if you see anything..
Thanks again!
Views
Replies
Total Likes
There is nothing wrong with your code. You placed it on the Initialize event which means that it is only executed when the form starts up. Take the code out of that event and put it on the Calculate event. Now it will fire everytime a referenced field (from your calculation) changes.
Paul
Views
Replies
Total Likes
*HEADSLAP*
thanks for opening my eyes.. I was about to go batty..
Thanks everyone for all the help!
Views
Replies
Total Likes
Below is the working script..
if (Date2Num($.formattedValue, "M/D/YYYY") >= Date2Num("7/1/2011", "M/D/YYYY"))then
Table1.Row2.rate1.rawValue = .555
else
Table1.Row2.rate1.rawValue = .51
endif
You had placed the script in the Initialize event of the Mileage rate field. It is supposed to be in the Exit event of the Date field in the same row.
https://acrobat.com/#d=OufLQsJsnoBOoxy-JmDRiA
Thanks
Srini
Views
Replies
Total Likes
Views
Likes
Replies