Expand my Community achievements bar.

SOLVED

Another Datequestion please advise?

Avatar

Level 2

After reading most of the Date messages I still couldn't find were I was looking for.

I am new to LiveCycle and hope to learn from you guys!

I presume it is very simple but unfortunately I do not know any formcalc or Java.

Could anyone please help me with a step-by-step instruction to achieve the following:

I have a Date/Time Field  that is filled in by the user of the form.

The field is a Date/Time Field with bindingname Keurdatum

Now I would have another Date/Time Field with bindingname Herkeurdatum

that should automatically show the filled in date by the user added with 1 year

For example User enters: 02-10-2011 in the Keurdatum field.

in the Herkeurdatumfield automatically it shows 01-10-2012

I would be very pleased if any one could help me with this question!

Jan Willem

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

it's hard to say, what's wrong in your form without seeing it.

Anyway, here's a sample for you.

https://acrobat.com/#d=fQTuP3uz*l7dohA7tX3g7A

View solution in original post

6 Replies

Avatar

Former Community Member

I hope this helps...

On your form, place two invisible textfields named Year and  Date respectively.

In the Year Field calculate event (use Formcalc), place this :

If(Keurdatum.rawValue >"") then

$.rawValue =(Substr(Keurdatum.rawValue,0,4)+1)

else

$.rawValue eq ""

endif

In the Date Field calculate event (use Formcalc), place this :

If(Keurdatum.rawValue >"") then

$.rawValue =Substr(Keurdatum.rawValue,5,6)

else

$.rawValue eq ""

endif

In the Herkeurdatum (or the field you want to add a year to) place this (in FormCalc) calculate event:

$.rawValue =concat(Year.rawValue,Date.rawValue)

Avatar

Level 10

Hi,

here's another method.

It also considers leap years.

if (Keurdatum ne null) then

     var nDate = Date2Num(Keurdatum.formattedValue, "DD.MM.YYYY")

     var nYear = Num2Date(nDate, "YYYY")

     var nMonth = Num2Date(nDate, "MM")

     var nDay = Num2Date(nDate, "DD")

     $ = Num2Date(Date2Num(Concat(nDay, ".", nMonth, ".", nYear + 1), "DD.MM.YYYY")- 1, "DD.MM.YYYY")

endif

Put this FormCalc script into the layoutReady:Event of the field Herkeurdatum.

Avatar

Level 2

Thank you all, I am going to try both solution and inform you when things are working!

Your help is highly appreciated!

Jan Willem

Avatar

Level 2

Srini; Radzmar;

Srini first of all I would like to thank you for your help solving my GHOST page problem!

It worked flawlessly. Here is the proof that i am a true beginner!

Still have my date related problem. I have posted the form again with the code on its place.

Also I have added the code on the Herkeuringslocation in the calculate event (formcalc)

and also (as the Radzmar advised) in the LayoutReady-event of Herkeurdatum.

I have tried everything but must be missing something.

Both field are on page 2 of the form,

Keurdatum is linked to other Keurdatum- fields (global setting) could that has anything to do with my problem?

Again a big thank you for your help! Highly appreciated!

Jan Willem

Avatar

Correct answer by
Level 10

Hi,

it's hard to say, what's wrong in your form without seeing it.

Anyway, here's a sample for you.

https://acrobat.com/#d=fQTuP3uz*l7dohA7tX3g7A

Avatar

Level 2

RADZMAR:

Worked great! The problem was the link to local fields with the global function.

When I isolated the fileds all worked perfect!

Thank you all for helping me out!

Regards;

Jan Willem