Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Offsetting Date in Second Date Field (LiveCycle)

Avatar

Avatar
Validate 1
Level 1
Nate_Adam
Level 1

Like

1 like

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
Nate_Adam
Level 1

Like

1 like

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
Nate_Adam
Level 1

25-04-2018

Hi, I am currently designing a form and in a particular section I have enabled the user to select the current month using a date picker (Date/Time Field) where a second Date/Time Field will automatically fill.

I have set the Data Connection to global (so they are connected), however I wish to offset the date in the second date field by nine months, where April 2018 will appear as January 2019, May 2018 as February 2019, and so on.

Please let me know how I may be able to do this.

Thanks,

Nate

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile
_Bruce_Robertson
MVP

26-04-2018

Hi Nate,

I think you should remove the global binding and use a calculate event in the second date field, Something like this JavaScript

if (!DateField1.isNull) {

    var date = util.scand("yyyy-mm-dd", DateField1.rawValue);

    if (date != null) {

        date.setMonth(date.getMonth() + 9);

        util.printd("yyyy-mm-dd", date);

    }

}

You should just need to change the name of the first date field from the DateField1 name I have used in the above sample.

Bruce

Answers (1)

Answers (1)

Avatar

Avatar
Validate 1
Level 1
Nate_Adam
Level 1

Like

1 like

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
Nate_Adam
Level 1

Like

1 like

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
Nate_Adam
Level 1

26-04-2018

Hi Bruce,

Thank you for the prompt reply.

I was able to implement the above script in LiveCycle and it works exactly as required.

I greatly appreciate your help and once again, thank you.

Regards,

Nate