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

CASE with text and if Date 1

Status
Not open for further replies.

rwn

Technical User
Joined
Dec 14, 2002
Messages
420
Location
US
This is the Case statement that I'm using and then having it do a Group Sort.

Formula Name = @GroupSort
Select {@OptSortBy}
Case 1: {SF_ProductionOverview_TTX.Job}
Case 2: {Delivery.Promised_Date}
Case 3: {SF_ProductionOverview_TTX.Customer_PO}

But, the error message indicates the the xxx.customerPO "A Date is Required here
 

All conditions of a case statement, or if..then statement, must return the same datatype. It looks like you're returning two numbers and a date (unless the PO and Job fields are text).

In this example, you'll have to convert all the fields to text, such as:

totext(delivery.promised_date)

Check out CR help on totext to see examples of the different format strings you can include to display dates and numbers in the format you want.

 
I tried that first with this:
Select {@OptSortBy}
Case 1: {SF_ProductionOverview_TTX.Job}
Case 2: cstr({Delivery.Promised_Date})
Case 3: {SF_ProductionOverview_TTX.Customer_PO}

It doesn't sort by the true date then.
 

Then you'll need to convert to a format such as 20100910 that will sort properly:

totext(promised_date,"yyyyMMdd")

Then use a formula in the Customize Group Name area of the Change Group dialog in order to display it in the format that you really want to see it.

 
thank you. i will try later. is there a way to set the text date to asending sort order?
 

The 20100912 format will sort ascending, unless you tell CR otherwise.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top