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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Group sort on a formula

Status
Not open for further replies.
Mar 19, 2003
57
US
I am using the formula below to sort by TIME in the group section in my report. The sort works fine on a Sybase DB with all the TIMES appearing in ascending sequence. However, when I use this same formula on a Informix DB, the TIMES are not sorting in ascending nor descending sequence. The data is all there, but the sort is not in any logical sequence. How do I get this sort to work on a Informix DB?


Numbervar minextract := minute({acdgroupstats.d_time});
Stringvar amdmins;

if minextract <= 15 then amdmins := ToText(time(hour({acdgroupstats.d_time}),00,00)) & "," & "-" & "," & ToText(time(hour({acdgroupstats.d_time}),29,00))

else

if minextract >= 30 then amdmins := ToText(time(hour({acdgroupstats.d_time}),30,00)) & "," & "-" & "," & ToText(time(hour({acdgroupstats.d_time}),59,00));

amdmins;
 
It shouldn't sort correctly on any database as it's text, not a value.

Drop the totext portion for sorting, add it for display purposes:

Sort on:

time(hour({acdgroupstats.d_time}),00,00))

-k
 
Thanks for the advice. It works great on Informix DB! Its still weird how the original formula I used to group/sort data on Sybase DB works fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top