Powerbuilder – Datawindow Filter on a datetime column

Posted on Friday, November 5th, 2010 at 8:20 pm in

A question came in on the TekTips Powerbuilder forum regarding filtering on a datetime column in a datawindow. Basically the problem was a ‘type mismatch’ error when trying to filter this type of column. This is how the author was setting the filter:

 ls_filter = "ls_column_name= '11/10/2010 12:30:00'"
or ls_filter = "ls_column_name= '" + ls_dateval + "'"

The answer is to convert the column data value to the same format as being tested for.
ls_filter = "string(" + ls_column_name + ", 'mm/dd/yyyy hh:mm:ss)' = '11/10/2010 12:30:00'" 
or ls_filter = "string(" + ls_column_name + ", 'mm/dd/yyyy hh:mm:ss)' = '" + ls_dateval + "'"
You might also be interested in

Add your comment

Leave a Reply

Top