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

Multiple Columns in Group Sections

Status
Not open for further replies.

kskid

Technical User
Mar 21, 2003
1,767
US
A am looking for a formula that will take my grouped summary counts and display them in multiple columns.

I saw the "Format with Multiple Columns" on the detail section but disappears when I click on anything other than the detail section.

Thanks,

Larry

 
you can simply create display formulas and put the values anywhere you want.

Jim Broadbent
 
Can you give me an simple example to give me the basics?

I am a relative newcomer to Crystal so I am still learning the intricacies of programming formulas but have become quite adept at modifying existing formulas to suit my needs.

For example, I have the group data that currently has a map area and count.

Map Call
Area Count
11 10
22 11
33 20
44 15
etc


Map Call Map Call Map Call
Area Count Area Count Area Count
11 10 33 20 etc
22 11 44 15

Larry


 
I'm not familiar with Jim's method, which might be simpler than the following.

If you don't have a huge number of map areas, you could develop a running total for each map area. Using the running total wizard, select {call} and count as the summary, evaluate on change of formula:

{MapArea} = 11 //substitute other values in other running totals

Reset never (or on change of the next higher order group, depending on your desired results). Then place {#MapArea11} in the report footer (or in the group footer of the next higher order group). Repeat for each map area, using text boxes to enter column and row labels and to create the column design.

-LB
 
*************
Map Call
Area Count
11 10
22 11
33 20
44 15
etc


****************

Ok...these are results displayed in the group footer section for the group Map Area.

I use a different approach to lbass...basically because it is the way I have always done it...I don't use running totals very much prefering to do my totaling manually...but his method probably has merit too....there are many ways to acomplish the same effect in CR.

This is my way.

If there is no group before Map Area I would put the following initializing formula in the Report Header

@Initialize (suppressed in report header)

WhilePrintingRecords;
//estimate the number of Map Areas then add 50% for later
//report expansion. Eg. if there are currently 50 map areas
//initialize 75...use the same number for Calls
StringVar array MapArea := ["","","",......"","",""];
StringVar array Calls := ["","","",......"","",""];
NumberVar pointer := 0;

If this is in a Group Header before the Group Map Area then modify the formula slightly

WhilePrintingRecords;
//estimate the number of Map Areas then add 50% for later
//report expansion. Eg. if there are currently 50 map areas
//initialize 75...use the same number for Calls

If not inrepeatedGroupHeader then
(
StringVar array MapArea := ["","","",......"","",""];
StringVar array Calls := ["","","",......"","",""];
NumberVar pointer := 0;
);

Now in the Group footer were you are currently Displaying the Map Areas/Calls replace these fields with the following field and suppress the Group footer totally

@CollectSums

WhilePrintingRecords;
StringVar array MapArea ;
StringVar array Calls ;
NumberVar pointer ;

//if Map Area is a number convert it to a string as well
//convert Calls to a string

pointer := pointer + 1;

//you want a maintenance alert if you exceed your estimated
//number of entries...perhaps this can be done dynamically
//with a redim though I have never done it myself

If pointer >= ubound(MapArea) then
(
//this will give us a clue as to how much data we lost
MapArea[ubound(MapArea)] := "Missing";
Calls[ubound(MapArea)] := "Data =" + totext(pointer,0);
)
else
(
MapArea[pointer] := {table.MapArea} //convert to string
//if necessary
Calls[pointer] := totext(sum of calls,0);
);

Now in the Group footer of the group before Map Area or in the report footer if there is no Group you place the results

For Balance determine how many columns you want. You are limited to 254 chars/string but map areas seem to be only 2 or 3 chars so that is no limitation really...there amy be say 1000 calls so that is no problem also...

The number of columns is really determined by how many areas are displayed...

For example: Let us say we had 50 areas/calls...within the 254 char limit we could display all values in one "can Grow" string formula for Map Area and Calls respectively but that would not be what we want... A better look would be 5 columns of 10 rows each

So we would create 5 display formulas for Map Area and 5 for Calls

@Display_MapArea_1

WhilePrintingRecords;
StringVar array MapArea ;
StringVar result1 := "";

if MapArea[1] <> &quot;&quot; then
result1 := &quot;Map Area&quot; + Chr(13) + Chr(10) +
&quot; &quot; + MapArea[1]+ Chr(13) + Chr(10) +
&quot; &quot; + MapArea[2]+ Chr(13) + Chr(10) +
&quot; &quot; + MapArea[3]+ Chr(13) + Chr(10) +
&quot; &quot; + MapArea[4]+ Chr(13) + Chr(10) +
&quot; &quot; + MapArea[5]+ Chr(13) + Chr(10) +
&quot; &quot; + MapArea[6]+ Chr(13) + Chr(10) +
&quot; &quot; + MapArea[7]+ Chr(13) + Chr(10) +
&quot; &quot; + MapArea[8]+ Chr(13) + Chr(10) +
&quot; &quot; + MapArea[9]+ Chr(13) + Chr(10) +
&quot; &quot; + MapArea[10] ;
result1;

Similarly for Calls you would do

@Display_Calls_1

WhilePrintingRecords;
StringVar array Calls;
StringVar result2 := &quot;&quot;;

//this if checks for data if there is none then the
//formula will be null and nothing seen
if Calls[1] <> &quot;&quot; then
result2 := &quot;Calls&quot; + Chr(13) + Chr(10) +
&quot; &quot; + Calls[1]+ Chr(13) + Chr(10) +
&quot; &quot; + Calls[2]+ Chr(13) + Chr(10) +
&quot; &quot; + Calls[3]+ Chr(13) + Chr(10) +
&quot; &quot; + Calls[4]+ Chr(13) + Chr(10) +
&quot; &quot; + Calls[5]+ Chr(13) + Chr(10) +
&quot; &quot; + Calls[6]+ Chr(13) + Chr(10) +
&quot; &quot; + Calls[7]+ Chr(13) + Chr(10) +
&quot; &quot; + Calls[8]+ Chr(13) + Chr(10) +
&quot; &quot; + Calls[9]+ Chr(13) + Chr(10) +
&quot; &quot; + Calls[10] ;
result2;


The reason for 2 formulas is so that they will have a razor sharp edge when printed side-by-side

In a similar manner create 4 more sets of formulas for 11-20, 21-30, 31-40 and 41-50

Arrange them in the footer (report or otherwise) and there you have it....make sure the &quot;can Grow&quot; is turned on for each formula

Hope this helps.







Jim Broadbent
 
Thanks.

I'll give them a try and report back.

WichitaKid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top