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

Crystal Report from Excell data

Status
Not open for further replies.

GoBrowns

Programmer
Jun 12, 2003
4
US
Hi,

I have a a Crystal 9 report where I am going against MS Excel for data. I have a formatting / formula question

Here is my data (in an Excel sheet);

Serial_Number
11111
22222
33333
44444
nnnnn

I will have n rows of serial numbers and would like to display them on my Crystal Report like this:

11111, 22222, 33333, 44444, 55555, 66666.

I have tried different groupings and formula fields and the next function only works on one record.

Any ideas would be great.

 
A simple approach is to format the detail section with multiple columns:

Right Click the detail section,
Format Section,
Format with Multiple Columns
and use the Layout tab.

A more complex approach is to concatanate the values into a string variable in a formula placed in the detail section.

hth,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Ido,

Thanks for the response. I would like to take the more complex approach as this report will eventually be run with a dynamic data source from a .net app.

I have been trying to concatinate the values but cannot get to the next value within the formula. The NEXT function only goes to the immidiate next value. So in my example, I would only get "1111, 2222"

-Brian
 
I don't believe the "dynamic data source" makes the simpler approach not viable.

In any case, here's the more complex one in detail(assuming you are grouping on something):
---------------------------------------------------

Create 3 formulas:

In Group Header (suppressed):
------------------------------
whileprintingrecords;
Global Stringvar ls_SN :="";
------------------------------

In Detail section (suppressed)
------------------------------------
Global Stringvar ls_SN;
ls_SN := ls_SN + {Serial_Number} +", "
------------------------------------

In the group footer (show):
------------------------------------
whileprintingrecords;
Global Stringvar ls_SN;
left(ls_SN,length(ls_SN)-1)
------------------------------------

Note: in versions below CR 9.0
the string variable is limited to a length
of 254 characters.

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Correction -- the last formula should be:
------------------------------------
whileprintingrecords;
Global Stringvar ls_SN;
left(ls_SN,length(ls_SN)-2)
------------------------------------

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Ido,

Thanks for your help. I got it working, but not like you suggested. I never got the formula in the detail footer to work, it was always null. What I ended up doing was putting the detail formula into the report footer.

I got it working, but have no idea why your example would not.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top