Setting a Date upon Startup

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
Benrie
Posts: 3
Joined: Tue Sep 05, 2017 10:22 pm

Setting a Date upon Startup

Post by Benrie »

What is the best way to set dates upon startup? I have a web app where the user can select beginning and ending dates for search criteria. I want to set these when the web page loads up so they don't have to. How can I do this easily?
jyoung
Posts: 694
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Re: Setting a Date upon Startup

Post by jyoung »

There are typically two entry points you can hook into.

1. is the CreateInstance Event
2. is the Initialized Event

http://docs.lansa.com/14/en/lansa016/pr ... stance.htm

http://docs.lansa.com/14/en/lansa016/pr ... ialize.htm

The general recommended advice is to use the CreateInstance event.

EDIT
To set the actual dates, if your Field is a date type you can use something like

#StartDate := #STD_DATEX.Now

Once you have a date, there are all kinds of methods to manipulate it in the Date Intrinsics.
http://docs.lansa.com/14/en/lansa016/pr ... insics.htm

Hope this helps,
Joe
Benrie
Posts: 3
Joined: Tue Sep 05, 2017 10:22 pm

Re: Setting a Date upon Startup

Post by Benrie »

Thanks Joe! I will give that a try.
Benrie
Posts: 3
Joined: Tue Sep 05, 2017 10:22 pm

Re: Setting a Date upon Startup

Post by Benrie »

This solution worked as expected and is giving me the dates as I want. Thanks again!
atostaine
Posts: 696
Joined: Wed Jan 20, 2016 7:38 am

Re: Setting a Date upon Startup

Post by atostaine »

You can do #startDate := #startDate.now also :D
Art Tostaine
Post Reply