Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Powerbuilder resets date and time when one of them is modified

Posted on 2007-11-28
3
Medium Priority
?
595 Views
Last Modified: 2013-12-26
I have a date column in my datawindow which i separated into two fields using edit mask one has mask of 'mm/dd/yy' and the other 'hh:mm'.
but when i modify the date field then the time field becomes 00:00
and when i modify the timefield then the date field becomes 01/01/1900

so i can never place an approrpiate date/time because they keep canceling eachother out.

i tried manipulating the 'data' value within itemchanged event since that's where i noticed it'd rest the time.
but that didn't work. i tried using replace, and setitem, then accepttext() and that didn't work i still get time = 00:00.

please point me to the right direction.

0
Comment
Question by:badtz7229
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
ced888 earned 2000 total points
ID: 20372876
You should make two columns one for date and one for time. You can achieve this by modifying your select

example:

SELECT dt_actual_date,
              dt_actual_date    date_portion,
              dt_actual_date    time_portion,
FROM yourtable

Make sure to use an alias on the second and third datetime columns. The date_portion should be masked only for the date and the time should be masked only for the time.

This way you will have two columns one for the date one for the time. When the date or the time portion is changed, you setitem dt_actual_date based on the value of the date_portion and the time_portion. By the way, the date_portion and the time_portion is not included in the updatable columns You can also hide the dt_actual_date column since it is only used to setitem and to getitem.

We have been doing this for all of our payroll applications which has a separate date and time entry but is basically stored in one DATETIME column.

Thanks.
0
 

Author Closing Comment

by:badtz7229
ID: 31411503
Thank you so much. That totally resolved my issue.
0
 

Author Comment

by:badtz7229
ID: 20397329
I just had one quick question about your solution , you stated
"By the way, the date_portion and the time_portion is not included in the updatable columns "
Did you mean that the date_portion and the time_portion should NOT be selected as updatable columns, in the Update Proporties ?
In my case, i did not select them .
Please clarify, thanks.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question