Solved

# Conditional formatting of Group Sort order constants

Posted on 2010-01-04
Medium Priority
2,271 Views
I have Best/Worst sellers report

I am using the Group expert\"SORT"\Options\X2 to out put whether my report is a best or worst sellers, or CrascendingOrder or CrdescendingOrder

"SORT" is a formular feild ;

If {?SORT} = "48" then {styleperformance.QtyRecv} else
If {?SORT} = "49" then {styleperformance.QtyOnHand} else
if {?SORT} = "53" then {styleperformance.QtySold} else
if {?SORT} = "54" then {@DAYS TO TOI} else
if {?SORT} = "55" then {@DaysinPeriod}

I have a Parameterfeild, {?reporttype} "best" or "Worst"

I want to say,

If {?ReportType} = "Best" and  {?Sort} = "48" or "49" or "53"  then Crascending else descending;
if {?ReportType} = "Worst" and {?Sort} = "54" or "55" then CrDescending else CrAscending;

I need this otherwize My best is always Descending... And "Days to turn over inventory", and Days in Period are only best sellers if they are Ascending.

Couls someone help me, to see if

1) its possible to do what i want to do in this X2 part of the sort  and
2) how to write the formular

Thanks
Jason

0
Question by:kingjely
• 2
• 2

LVL 8

Author Comment

ID: 26177274

I tried this, but it says "the formular Result is not valid for this formular"
Im doing it wrong, coz i need the case "Best" to be

Case {?ReportType} = Best

Numbervar x;

For x := 1 to Len({?SORT}) Step 2
do
Select mid({?SORT},x,2)
Case "Best":
If {?SORT} = "48" then CrDescendingOrder else CrascendingOrder
Case "Best":
If {?Sort} = "49" then CrDescendingOrder else CrascendingOrder
Case "Best":
If {?SORT} = "53" then CrDescendingOrder else CrAscendingOrder
Case "Best":
If {?SORT} = "54" then CrAscendingOrder else CrDescendingOrder
Case "Best":
If {?Sort} = "55" then CrAscendingOrder else CrDescendingOrder
Case "Worst":
If {?Sort} = "48" then CrAscendingOrder else CrDescendingOrder
Case "Worst":
If {?Sort} = "49" then CrAscendingOrder else CrdescendingOrder
Case "Worst":
If {?Sort} = "53" then CrAscendingOrder else CrDescendingOrder
Case "Worst":
If {?Sort} = "54" then CrDescendingOrder else CrAscendingOrder
Case "Worst":
If {?Sort} = "55" then CrDescendingOrder else CrAscendingOrder;

x
0

LVL 35

Accepted Solution

James0628 earned 2000 total points
ID: 26177478
I'm ignoring that last formula you posted for the moment, because it doesn't make much sense.

> If {?ReportType} = "Best" and  {?Sort} = "48" or "49" or "53"  then
> Crascending else descending;
> if {?ReportType} = "Worst" and {?Sort} = "54" or "55" then
> CrDescending else CrAscending;

To combine those conditions, try:

if {?ReportType} = "Best" then
if {?Sort} in ["48", "49", "53"] then
CrAscending
else
CrDescending
else
if {?ReportType} = "Worst" then
if {?Sort} in ["54", "55"] then
CrDescending
else
CrAscending
else
//  {?ReportType} is neither "Best" nor "Worst"
CrAscending

If {?ReportType} can only be "Best" or "Worst", you can simplify that slightly as:

if {?ReportType} = "Best" then
if {?Sort} in ["48", "49", "53"] then
CrAscending
else
CrDescending
else
// {?ReportType} = "Worst"
if {?Sort} in ["54", "55"] then
CrDescending
else
CrAscending

James
0

LVL 8

Author Closing Comment

ID: 31672727
Great work mate,

Yes i work myself into circles, i get confused, and just try stuff, I dont have any help or guidance or training, so it drives me nuts when i cant understand or can't ask anyone.

Thanks Very much for your help and patience

Jason

0

LVL 35

Expert Comment

ID: 26182867
You're welcome.  Glad I could help.

Just to be clear, I wasn't trying to criticize your second formula in any way.  Yes, to be honest, it was a mess ;-), but that wasn't my point.  I was just trying to make it clear that I wasn't trying to go by anything in that formula.  I was only looking at those conditions from your original post.

James
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Integration Management Part 2
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
###### Suggested Courses
Course of the Month16 days, 13 hours left to enroll