Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to sort a text field like it were a number

Status
Not open for further replies.

skiabox

Technical User
Aug 27, 2002
125
0
0
GR
I have a row formula in a cross tab that contains this code :

CStr({@hour1},0) + ':00'

@hour1 is : hour({LABSTORE.REC_TIME})

What I get is a column like this

10 : 00
11 : 00
12 : 00
.
.
.
9 : 00

How can I sort this properly like it were a number?
I mean like this
9 : 00
10 : 00
11 : 00
12 : 00

Thank you.
 
The only way to SORT a string like this is to convert it into Military Time (with a leading "0" where required).

IF @hour1 < 10 THEN "0" + CStr({@hour1},0) + ":00"
ELSE CStr({@hour1},0) + ":00"

09:00
10:00
11:00
12:00

How do you plan on handling AM/PM..?



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top