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!

Group

Status
Not open for further replies.

crystalbeginner15

Programmer
Sep 6, 2005
76
US
I have created a report which have groups

I have grouped by direction then by lanes
direction
lanes

The way I get is
l-lane and N and S (North and South)

l1(N)
l2(N)
l3(N)
l1 (S)
l2(S)
l3(S)
The way I want to get is when there is change is direction(which is top most group) I should get

l1(N)
l2(N)
l3(N)
l3 (S)
l2(S)
l1(S)

Please help in doing this way.

Thank you.
 
Use a formula that inserts a one-letter prefix. If there are just the three lanes, it could be
Code:
if {lane} = 3 
   if {direction} = N then "c) l3(N) else "d) l3(S)
else
if {lane} = 2
   if {direction} = N then "b) l2(N) else "e) l2(S)
else
if {lane} = 1
   if {direction} = N then "a) l1(N) else "f) l1(S)
Group using this formula, rather than direction and lane.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
It looks like {table.lane} is a string field that appears like "l1", "l2", "l3", etc. In that case, try a formula like:

if {table.direction} = "N" then val(right({table.lane,1)) else
if {table.direction} = "S" then -val(right({table.lane,1))

Use this formula as your second group, but display the actual field instead of the groupname on the report.

-LB
 
Sorry for the confussion. Actually the ln1....ln3 are the
names I have put on the report I get the lane number(numbers) as1,2,3....... from the table so when I use lane number as my second group whenever there is a change in first group(direction) I want that data to be read in the reverse lane number order
1
2
3
3
2
1
 
Then use:

if {table.direction} = "N" then {table.lane} else
if {table.direction} = "S" then -{table.lane}

-LB
 
Insert a group on direction. Then insert a group on my formula (make sure you have the "-" sign in the second clause. Then replace the groupname in group#2 with your field {table.lane}. No reason this shouldn't work that I can think of.

-LB
 
I had a group by lane then I changed the group with the formula and I checked I have (-) I get it as
ln1(N)
ln2(N)
ln3 (N)
ln3(S)
 
That is the correct sort per your requirements for those records that are appearing, but where are the other two records that you showed in your sample?

Show a larger sample, please.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top