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!

Sorting records in a group 1

Status
Not open for further replies.

maas

Programmer
Sep 3, 2009
148
BH
Hello All,

I am having a group called Deal_no and one of the records which is showing is the Deal type.

The Deals Type can be "SE", "OB","RE", "ME".

Now, I want to sort these types while veiwing for each group. The sort which I want is that types with OB should be first then the others are coming. Currently they are mixed up.

Can you please help.

Thanks
 
Create a formula {@typeorder} like this:

if {table.dealtype} = "OB" then 1 else
if {table.dealtype} = "ME" then 2 else
if {table.dealtype} = "RE" then 3 else
if {table.dealtype} = "SE" then 4

Place this formula in the detail section and insert a minimum on it at the typeno group level. Then go to report->group sort and select "minimum of {@typeorder} as your group sort field in ascending order.

-LB
 
In rereading, I'm not sure whether you really want the groups sorted or whether there can be multiple deal types within each deal number and you just want the records sorted within the groups.

If just the records within the groups, use the formula {@typeorder} in report->sort records instead of using the group sort feature.

-LB
 
Hello lbass,

Thanks for your help.

What I am looking for is E.X:

123 (Group Name)
Details: "SE" , Paid
"OB", SOLD

What I want is :
123
Details: "OB", SOLD
"SE", Paid

and if the types are alot, the only thing which I want to be the first after the group name is "OB" and then I don't care how the sorting will be. Can I use:

typeorder:
if {table.dealtype} = "OB" then 1 else 2 ?

Also, can this be done in record expert ?
 
Sure, create that formula and then go to report->sort records and add it there.

-LB
 
Thanks lbass for your help and I will try it
 
lbass,

I tried it, but it did not work for me.

I tried the solution regarding creating a formula

typeorder:
if {table.dealtype} = "OB" then 1 else 2

and then use the record sort expert to sort in ascending, but it did not work.

still the 2 is coming at first and the 1 is at the last
 
Please identify the fields you are grouping on. Groups always have priority over sort fields. If you have an inner group on type, it would have priority.

-LB
 
Yes, I am having more than 5 groups. SO in that case what would you suggest?
SHould I group by the typeorder and make it at the top of the group? or you are having a suggestion?
 
Please identify the fields you are grouping on, and then show a sample of your current report and a sample of how you would like it to look.

-LB
 
Thank you lbass,

I have resolved the issue and it was from the group
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top