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

Combining 2 rows of detail in 1 row? 1

Status
Not open for further replies.

PeterConnick

Programmer
Nov 26, 2002
21
US
Crystal Report 8.5
ODBC Oracle Database

I need to get the Departure value and the final Destination value from the travel legs table. Here is an example. If an invoice item contains a stopover on a trip (e.g., Rankin Inlet to Iqaluit to Ottawa), the invoice item will have two travel legs associated with it:

Depart Dest. Leg (this column is available as well)
YRT YFB 1
YFB OTT 2

The report will need to pick up the Departure location of YRT and the Destination of OTT.

I am trying to get this all on one line in the report.


But I am getting something like this.


Ticket Number Passenger Name Depart Dest
1 Paul Smith YRT YFB
1 Paul Smith YFB OTT

I tried grouping on ticket number and moving detail line to group by line but I get this.

Ticket Number Passenger Name Depart Dest
1 Paul Smith YFB OTT

I can get it to work by using previous(Depart) function. But this will not work if the trip has 3 or more legs.

 
First insert a group on ticket number. Then create a formula:

whileprintingrecords;
stringvar depart;
stringvar dest;

if {table.leg} = minimum({table.leg},{table.ticketno}) then
depart := depart + {table.depart;
if {table.leg} = maximum({table.leg},{table.ticketno}) then
dest := dest + {table.dest};

Place this in the detail section and suppress it. Then create two formulas for the ticket group footer:

whileprintingrecords;
stringvar depart;

whileprintingrecords;
stringvar dest;

Then drag the group name and customer name into the group footer along with these display formulas, and then suppress the detail section.

-LB
 
LBass

I followed your instructions above and it worked for the first line.

Ticket Number Passenger Name Depart Dest
1 Paul Smith YFB OTT


The second line of the report will display the Ticket Number 2 and so on. Here is what I am getting. Mary & Peter's flight info was the same as Paul's. I am also grouping by Airline.


Group BY (1) Airline
Group By (2) Ticket Number

Ticket Number Passenger Name Depart Dest
1 Paul Smith YFB OTT (GF2)
2 Mary MacDonald YFBYFB OTTOTT
3 Peter Murphy YFBYFBYFB OTTOTTOTT

It looks like I am concatenating the values. How do I reset (Depart and Dest)?

Thanks for your help
 
Never mind I got it.

Here how I did it just in case some else is having the same problem.

Create two new formulas

WhilePrintingRecords;
stringvar depart := '';

WhilePrintingRecords;
stringvar dest := '';

Then I placed this in the group header 2 (Ticket Number)

Thanks again LBass
 
Sorry, forgot to mention the reset formula. You can do it all in one formula, by the way:

WhilePrintingRecords;
stringvar depart := "";
stringvar dest := "";

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top