1. Pete Yankovich
  2. PowerBuilder
  3. Friday, 25 September 2020 13:41 PM UTC

In PB 2017 R2, there is a datawindow with a date column.  It is using the PFC sort.  When the date column header is clicked, the rows sort as the string value of the date, not as the date value of the date.  Is there a way to make it sort as a date?

Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 25 September 2020 14:14 PM UTC
  2. PowerBuilder
  3. # 1

Hi Pete,

I'm using the sort service of PFC also. We have never experienced that problem: our columns order correctly by date.

Can you export the datawindow and post it here?

(letting us know on which column / label you click?)

regards

Comment
  1. Miguel Leeuwe
  2. Saturday, 26 September 2020 23:36 PM UTC
the reason why I ask you for this, is that I think you might be sorting on "another" column or maybe the type is not date(time). The column you order on is "column_t" - the "_t", where "column_t" is the name of the label that you click on.
  1. Helpful
  1. Miguel Leeuwe
  2. Saturday, 26 September 2020 23:37 PM UTC
- the "_t" means: minus the "_t" (in case that was confusing)
  1. Helpful
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Saturday, 26 September 2020 16:12 PM UTC
  2. PowerBuilder
  3. # 2

Date manipulation has always been a tricky thing.

In my case, I have code in the ancestor CORP layer that intercepts the SORT command and checks for DATE values. If a DATE value is found,
   1. Save the current format
   2. Convert the format of the date to YYYYMMDDHHMMSSFFFF 
   3. Sort the data
   4. Convert the data back to the original format


Later -

Olan


FYI:
   The code inheritance structure:
   APP code <-- PFE <-- CORP <-- PFC

Comment
  1. Olan Knight
  2. Monday, 28 September 2020 14:27 PM UTC
Awesome! I'm we were able to help!
  1. Helpful
  1. John Fauss
  2. Monday, 28 September 2020 15:56 PM UTC
FYI, Pete - Your change may work for your environment and conditions, it will not work if the datatype of the column DWObject is "date", which in addition to "datetime" is valid for use with the drop-down calendar. I suggest you change the IF statement you added to:

if Mid(ls_datatype,1,4) = 'date' then
  1. Helpful
  1. Olan Knight
  2. Tuesday, 29 September 2020 23:48 PM UTC
Good catch, John.
  1. Helpful
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Monday, 28 September 2020 05:31 AM UTC
  2. PowerBuilder
  3. # 3

Hi Pete,

 

Maybe the PFC sort service uses the display value for sort?

There is an option of_SetUseDisplay. If the option is set AND the column edit style is DDDW, DDLB or it uses a code table the service uses the LookupDisplay funtion in sort.

HTH,

René

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.