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!

Can you change the sort order depending on Group #1? 3

Status
Not open for further replies.

cmpgeek

Technical User
Feb 11, 2003
282
US
i hope this will make sense to someone...

i have a report that is grouped like this:
group #1 itmcat.itm_prodcat
group #2 case.case_caseserv
group #3 case.case_casedate

group #1 only has 2 options: "tissue implants" or "others"

what i want to do if possible, is to change the sort order depending on group #1.

if group #1 = "tissue implants", i want it to sort strictly by date - case.case_caseserv is not important to this grouping.

if group #1 = "others", i then want it to group in the original order i have listed above...

as i said, i dont know if this is possible or not, but i would truly appreciate any suggestions anyone may have...

thanks

my vital stats: Crystal 8.5 / Oracle database / Windows 2000 Professional Edition...
... always in a state of [ponder] ... inspiring to some day experience [idea] ...
 
Display one or the other as a subreport. i.e main report contains only "tissue implants" data sorted in date order and subreport contains only "others" data sorted in original (id?) order.

Lisa
 
that was the first thing i thought of as well, but for some reason i am having trouble trying to figure out where to place it that will not disrupt the flow...

i have become rather comfortable with using sub-reports, so i dont know why this one seems so difficult... i just feel like i have hit a mental brick wall...

i have changed the groupings since the first time i tried a subreport, maybe if i play with it a bit more i will find something i am happy with...

thank you for your help - wish me luck...



my vital stats: Crystal 8.5 / Oracle database / Windows 2000 Professional Edition...
... always in a state of [ponder] ... inspiring to some day experience [idea] ...
 
You can group#2 on a formula called sortvalue.

If itmcat.itm_prodcat = "tissue implants" then " "
else case.case_caseserv


 
I would expand on MColeman's solution as I think it is the best choice

Make your group2 based on this formula

If {itmcat.itm_prodcat} = "tissue implants" then
"Case Date"
else
{case.case_caseserv};

I make the value "Case Date" to make the hierarchy tree look good...this creates a constant hence no grouping but in hte tree it looks like a label describing the data following.

Also...add this forumula to the conditional suppress of the Group 2 header and footers

WhilePrintingRecords;
{itmcat.itm_prodcat} = "tissue implants" ;

this will eliminate unwanted lines

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
thanks yall! you are the best!

my vital stats: Crystal 8.5 / Oracle database / Windows 2000 Professional Edition...
... always in a state of [ponder] ... inspiring to some day experience [idea] ...
 
I tested the sort formula (and was hoping that would work because I could use it!). The first group does indeed get sorted correctly, but in my case the second group is sorted randomly. Not in the same order as if I hadn't sorted them. If you know the item that causes them to be "in original order" I would use that instead of the " " for those you want in original order.

Lisa
 
kewl - thanks for the heads up !

my vital stats: Crystal 8.5 / Oracle database / Windows 2000 Professional Edition...
... always in a state of [ponder] ... inspiring to some day experience [idea] ...
 
Lisa - are your refering to your or my method??? I have tested mine and it works fine here

One thing to be careful of is to make sure every result in the Grouping formula is the same data type

If {itmcat.itm_prodcat} = "tissue implants" then
"Case Date"
else
{case.case_caseserv};

if {case.case_caseserv} is numeric then you must change it to a string using totext...eg. ToText({case.case_caseserv})

I tested this in CR 7 which I have at home and it works fine.

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Jim,

I tried your method in 8.5 and the "unsorted" group was not in the same order as if I hadn't sorted it at all.

Actually there is a simple solution to this since he wants the "unsorted" group to really sort by date..

First sort by the Sort formula then by date as the next sort.

Lisa
 
I think you are confusing SORT with GROUP

Instead of SOrting the data use grouping instead...reread my first post...it relates to grouping

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top