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!

groups problem 2

Status
Not open for further replies.

sikkilamkiran

Programmer
Aug 9, 2005
21
IN
I have a peculiar problem on groups.
I have a report which is having four groups

Library type
Library Name
Dimension
value
details- assessor - results - Date - Details ----
details- assessor - results - Date - Details ----

Library type can be - process,cycle,policy ,risk etc
Library name can be - MFG Process,Sales Process,Sales Cycle
Dimension can be - Department , plant, F/S Accounts
Value can be - Department-IT, Department-Finanace etc

now the report should show data like this

Library Name | Libray Type

Dimension | Value,Value,value ( since one dimension can have multiple values)

details ---------------------------------------
---------------------------------------

i have done to some extent but the only problem is concatenating the 'values' and showing it with the dimension. can any one please help me out its urgent req.

thanks in advance
kiran
 
You want to accumulate 'values' - presumably codes, because you are not adding them. I did something similar for postcodes, that you should be able to adapt.

Accumulate postcodes for groups
// Accumulate using a formula field (suppressed) in the detail line. Allow for nulls and blanks.
whileprintingrecords;
if not isnull({Recc.Postcode}) and {Recc.Postcode} <> " "
then stringvar pst := pst + {Recc.Postcode} +", "
else if length(pst) = 0
then stringvar pst := pst + "Excluding blanks; "
else stringvar pst := pst

// Show in using a formula field in the group footer.
whileprintingrecords;
stringvar pst;
left(pst,len(pst)-2)

// Clear using a formula field using in the group header.
whileprintingrecords;
stringvar pst := "";

Note that clearing in the footer avoids problems with group headers repeating on a new page, which does clear everything for the group. Provided the 'clear' is placed in the section AFTER the display, it will do them in that order.

If the 'values' are numeric, then use a formula field to turn them into srings, e.g. ToText({value})

It's helpful to give your Crystal version. In some cases there are big differences that depend on the version you have.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
If placing the dimension comma-separated array in the group header for Dimension is an absolute requirement,
you could create the following formula, assuming you have a group on library name and then on dimension:

"Dimension: "+ nthmostfrequent(1,{table.dimension},{table.libname})+
if distinctcount( {table.dimension},{table.libname}) > 1 then
", " + nthmostfrequent(2,{table.dimension},{table.libname})+
if distinctcount( {table.dimension},{table.libname}) > 2 then
", " + nthmostfrequent(3,{table.dimension},
},{table.libname})//etc.

Or you could insert a crosstab in the group header, using dimension as the column, which will give you the values, but without commas. Otherwise you will have to insert a subreport that accumulates the values.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top