The data isn't available in the group header unless you either use a SQL Expression (this is based on the database used) or a subreport.
Your post didn't include anything technical, such as:
Crystal version
Database/connectvity used
Example data
Expected output
An array would be filled AFTER the details displayed, so the report header wouldn't have them available.
If you created a shared array variable in a subreport within a group header section (right click the group header and select insert section below) then you could pass that array for each group to the subsequent group header section.
A SQL Expression creating a subquery would be more efficient.
Group Footer (for display):
Whileprintingrecords;
Stringvar TheNames
You don't need an array, however output from a formula is limited to a total of 154 chars in CR 8.5 or less (you thought I was just being a pain about the version mattering didn't you?).
If it exceeds 254 you may want a couple of formulas, let's hear, it gets tricky then.
Since you're using SQL Server 2000, you might also create a View on the database side to concatenate this in advance at the group level, which would prove faster, but it's even trickier.
Here's a formula that will give you the first 508 characters or so, and then ignore the rest--so if you have more characters than that, you will need to adapt this further. The code is only slightly adapted from a formula that another contributor here, Naith, developed in a much earlier thread:
//{@accum} to be placed in the details section:
whileprintingrecords;
stringvar firstst;
stringvar secondst;
if instr(firstst,{table.name}) = 0 then
if instr(secondst,{table.name}) = 0 then
if secondst = "" then
if len(firstst) + len({table.name} + ", ") > 254 then
secondst := secondst + {table.name} + ", " else
firstst := firstst + {table.name} + ", "
else
if len(secondst) + len({table.name} + ", ") > 254 then
secondst := secondst else
secondst := secondst + {table.name} + ", "
else secondst := secondst
else firstst := firstst;
I changed the variable names, so now you have two display formulas:
Insert a text box in the report footer, and add {@firstst}, followed by ", " and then add {@secondst}. Format the text box (format->text->common) to "can grow."
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.