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

Sort Order Formula 1

Status
Not open for further replies.

YANKRAY

Technical User
Nov 7, 2003
283
Crystal Reports 10.0

I have created this formula to allow the user a multitude of sort choices.

Because I have {PEMCO_CRYSTAL_ACTIVE_MASTER_VW.SENIORITY_DATE}
which is the only Date Field in one of my Then statemenst, Crystal is giving me the error that a Date-Time is required for my last Else statement.

Is there a way around this?


If {?SortField1} = "Badge Sort" Then {PEMCO_CRYSTAL_ACTIVE_MASTER_VW.BADGE_NUMBER}
Else
If {?SortField1} = "Name Sort" Then {PEMCO_CRYSTAL_ACTIVE_MASTER_VW.FULL_NAME}
Else
IF {?SortField1} = "Shift Sort" Then {PEMCO_CRYSTAL_ACTIVE_MASTER_VW.SHIFT_CODE}
Else
If {?SortField1} = "Dept Sort" Then {PEMCO_CRYSTAL_ACTIVE_MASTER_VW.DEPARTMENT}
Else
IF {?SortField1} = "Class Sort" Then {PEMCO_CRYSTAL_ACTIVE_MASTER_VW.CLASS_CODE}
Else
IF {?SortField1} = "Supervisor Sort" Then {PEMCO_CRYSTAL_ACTIVE_MASTER_VW.SUPERVISOR_NAME}
Else
If {?SortField1} = "Seniority Sort" Then {PEMCO_CRYSTAL_ACTIVE_MASTER_VW.SENIORITY_DATE}
Else {PEMCO_CRYSTAL_ACTIVE_MASTER_VW.PLANT}
 
Change it to:
Code:
  If {?SortField1} = "Seniority Sort" Then Cstr({PEMCO_CRYSTAL_ACTIVE_MASTER_VW.SENIORITY_DATE}, "yyyyMMdd")

Cheers,
- Ido

Visual CUT & DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
I did say Date Field but Crystal has corrected me.
It is a Date-Time Field.

I tried to rewrite your formula with "yyyyMMddhhmmss".
That didn't work.

What is the correct way to write the Date-Time?

Thanks,
Ray
 
All is fine Ido. I typoed the formula.

I wrote "yyy" instead of "yyyy".

Thanks for your help.

Ray
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top