cancel
Showing results for 
Search instead for 
Did you mean: 

display rows as columns in crystal

Former Member
0 Kudos

Hello,

I am using crystal reports version 9 and i have a requirement as below.

main report has a sub report in the page header section and the sub report gets data of the customer names linked to the customer in main report.

my sub report output currently shows as

NAME A

NAME B

but i want it to appear as NAME A, NAME B so that all the customer names appear in a line instead of seaprate rows on the report. is there a way to do this?

Thanks in advance for your help.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Suppress the detail section, and use this formula to concatenate all of the values (basic syntax):


WhilePrintingRecords

global nameList as string

if len(nameList) = 0 then
  nameList = {db.name}
else
  nameList = nameList + ", " + {db.name}
end if

formula = ""

Then in the subreport's footer, print the names:


WhilePrintingRecords

global nameList as string

formula = nameList

HTH,

Carl

Former Member
0 Kudos

Thank you carl for your help.

the customer names are now coming in the same line separated by a comma, but if my main report results have more than one page, the subreport results appear to be duplicated for each page. for example,

first page shows NAMEA, NAMEB

Second page shows NAMEA, NAMEB, NAMEA, NAMEB

third page shows NAMEA, NAMEB, NAMEA, NAMEB, NAMEA, NAMEB

and so on..

How can we suppress the duplicates or show NAMEA, NAMEB on all the main report pages?

thank you in advance.

Former Member
0 Kudos

Oops, change the second formula to:


WhilePrintingRecords
 
global nameList as string
 
formula = nameList

nameList = ""

HTH,

Carl

Former Member
0 Kudos

thank you very much for your help.

Answers (0)