Solved

Powerbuilder resets date and time when one of them is modified

Posted on 2007-11-28
3
533 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 500 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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. …
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now