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!

Formula to evaluate dates

Status
Not open for further replies.

jpeters01

Technical User
Dec 5, 2007
109
US
I need to evaluate dates and then create a value, and then sort by that value. This is a sample of my formula as there are many dates and the formula is quite long. The problem is that it won't sort correctly because the values it creates are strings:

if DATE ({up_rpt_receipt.RCV_RCV_DATE}) in [Date("12/14/2008") to Date("12/27/2008")]then "1" else
if DATE ({up_rpt_receipt.RCV_RCV_DATE}) in [Date("12/28/2008") to Date("1/10/2009")]then "2" else
if DATE ({up_rpt_receipt.RCV_RCV_DATE}) in [Date("1/11/2009") to Date("1/24/2009")]then "10" else

When I try to sort it gives me:
1
10
2

I need:
1
2
10

How can I modify the formula so that the results can be sorted numerically?




 
I figured this out...please disregard. Thanks!
 
Since you are dealing with strings, read up on how string fields are read and subsequently sorted. If you are remaining with string output, you will need to pad your string results with leading zeros so that they will sort in numerical order.



Lyle
----
I reject your reality and substitute my own. (Adam Savage)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top