Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Null time formatting as midnight in dw datetime column when time format set

I'm seeking advice regarding the default formatting of a null time to 12:00:00am in a dw datetime column when time format and/or edit mask set.

I am using PB12.5.2.

The application has a parsing routine that will extract times and dates from a string, ie 'Between 3pm and 4pm on 3 June 2015 Mr John Smith ....'  On other occasions there will only be one time, ie 'At 3pm on 3 June 2015 Mr John smith ....' The 'from' time will be valid, the 'to time' null but the 'to time' will default to 12:00:00am.  This is not a problem if the formatting/mask is turned of - the column will be empty.

I tried using the following 'modify' code if a null time was encountered, and use editchanged to turn the formatting/mask back on if the user decided to enter a time.  My modify code, below, must be wrong but is there a neater solution?

ldt_test = dw_event.GetitemDateTime(dw_event.GetRow(),'event_to_time')

If IsNull(ldt_test) Then



End if

Former Member
Former Member replied

Hi William,

I only have access to PB 10.2 at the moment so this may or may not apply to 12.5.2, but in 10.2 I can get null times to display as 'empty' instead of 12:00:00am when focus is not in the field by setting the format property. This only works when focus is not in the field, as soon as focus is placed in the field it will again display as 12:00:00am, but will change back to 'empty' when focus moves away from the field.

Format allows a definition for how the data will display when null values are encountered, so looking at your example you'd want to select the field in the DW painter, select the Format tab, set the format to HH:MM:SS;'' (the HH:MM:SS is how the data should display when there is a valid value, the '' after the ; is how the data should display for null values, ie '' - empty string), and make sure to check the Use Format checkbox.

If this doesn't work and you have to rely on your modify solution, I think you need to change




Hope this is of some use.


1 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question