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

Column Labels in Cross Tabs

Status
Not open for further replies.

052780

Programmer
Nov 5, 2007
17
0
0
PH
I have a cross tab report that should look something like:

<PortA> <PortB>
Airline Aircraft Pax Cargo Pax Cargo
<xxxxx> <xxxxxxx> <999> <999> <999> <999>
<xxxxx> <xxxxxxx> <999> <999> <999> <999>
<xxxxx> <xxxxxxx> <999> <999> <999> <999>

Those enclosed with <> are field values.
My problem is I'm not able to add the label "Airline" and "Aircraft"

Can anyone help me with this? Thanks a bunch!
 
You should give your Crystal version - 8, 8.5, 9, 10, 11 or whatever. Methods sometimes change between versions, and higher versions have extra options. This applies particularly to crosstabs.

It's also worth putting examples as ]code[ your data ]/code[, except with the square brackets the other way round. Like that, a fixed-width font is used and data lines up:
Code:
                       <PortA>       <PortB>
Airline   Aircraft    Pax  Cargo    Pax Cargo
<xxxxx>  <xxxxxxx>   <999> <999>  <999> <999>    
<xxxxx>  <xxxxxxx>   <999> <999>  <999> <999>    
<xxxxx>  <xxxxxxx>   <999> <999>  <999> <999>
{Airline} & " / " & {Aircraft} that could be used in a crosstab.

To combine data fields, had a field that linked two fields, like
Code:
{Airline} & " / " & {Aircraft}
That could be used in a crosstab.

If you want header labels, I think you'll need to do it the hard way, a 'Mock Crosstab' in which you define values yourself, usually running totals that use a formula.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
You can add headers by creating formulas like this:

whilereadingrecords;
"Airline/Aircraft"

Add this as your first row field and in the customize style tab, select it and check "suppress subtotals". Then select it in preview mode->rotate->90 degrees. Also format it to center justify and then drag the boundaries to minimimze it's width. This gives you a title along the side of the crosstab.

Otherwise your only option is to add a text box in the upper left corner, which can be hard to align, especially if the crosstab has virtual pages. You would have to format the box to repeat on horizontal pages, but I find that subsequent pages don't necessarily align the same way as the initial page.

The first method provides results that look best, I think.

-LB
 
Thank you for the advices, I'm using CR XI R2.
Madawc, by mock crosstab, do you mean manually simulating crosstab? How will dynamic number of columns be handled?

lbass, anyway that I can use the second option(add a text box in the upper left corner) and have it repeat on vertical pages?

Thanks a lot!
 
You would have to add the text box (or formula with borders) to the page header and format the page header to "underlay following sections". If your crosstab is not in a group header, you would have to create a formula like:

whilereadingrecords;
1

Insert a group on this formula, and put the crosstab in it. You would also need to conditionally suppress the text box to not display after the group header section, by creating a formula:

//{@true}:
whileprintingrecords;
booleanvar flag := true;

Place this in the detail section and suppress it. Then format the text box to suppress with this formula:

whileprintingrecords;
booleanvar flag;
flag = true //note no colon

-LB
 
A 'Mock Crosstab' is something that looks like a Crosstab, but in fact you define each column yourself, normally as a running total. This would need to go in the report footer, because running totals count as the reports 'run' and they will not be complete until then.

Crystal should have included an example along with the Crosstabs. You can save a little time by doing a paste to a dummy report, changing the name and then pasting back.

The drawback to mock-crosstabs is that you have to define the reported values. A new value would be ignored unless you changed the code. It will always have the same number of columns, which is sometimes an advantage.

You can use SEARCH to find out more.


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top