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

Concatenate a field till the end of all the records

Status
Not open for further replies.

sikar

Programmer
Jun 4, 2003
15
0
0
US
In my report i have a column in which i have to concatenate a database field till the end of all the records.How can i do this.please help me out.
 
You can create formulas and concatenate the two fields together each time like this:

"{dBfield1} & {dBfield2}"

Another option would be to add text objects to the report and drag the database fields into them.

Either option will give you what you are looking for.

~Brian
 
I think you are trying to concatenate the value of the same field? i.e. create a formula :

StringVar ReportData:= ReportData&Table1.Field1

replace italics with your database field and place this formula in the detail section.

Is this what you were after?????

Reebo
Scotland (Sunny with a Smile)
 
Reebo's formula will error out if the result string exceeds 254 characters in version 8.5 or earlier. If this is the case, you will need to create a string var array, and as each element of the array approached 254 characters, assign the string to the array, then reset your string to null, then continue concatenating until it approaches 254 characters, etc.

If you are in version 9 I believe the limitation is 64,000 characters.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
In Reebo's solution it concatenates at each record step by step.i need to concatenate it once only, till the end.How can this be done and i have to use this formula as group.
 
Maybe it's just me, but I'm a bit confused. I think you should explain what you want and give some example data. Also, what version of Crystal Reports are you using.....

Reebo
Scotland (Sunny with a Smile)
 
Rather than supply a vague text description of the intent, please post table layout(s), example data and expected output.

-k
 
Ok, the data looks something like this:
----------------------------------
field1 field2 field4

Anil Kumar BOM
Anil Kumar DEL
Anil Kumar ALH
Anil Kumar KER
Sunil Singh BOM
Sunil Singh DEL
Sunil Singh ALH
Sunil Singh KER
Amit Misra MDR
Amit Misra CHN
Amit Misra PNJ
Sumit Mittal MDR
Sumit Mittal CHN
Sumit Mittal PNJ
------------------------------------------
I want to group them like this:
-----------------------------------------
BOM/DEL/ALH/KER
field1 field2
Anil Kumar
Sunil Singh

MDR/CHN/PNJ
field 1 field2
Amit Misra
Sumit Mittal
-------------------------------------


 
You can create a group on field4. In the Insert Group dialog box, choose specified order. Name the groups "BOM/DEL/ALH/KER", "MDR/CHN/PNJ", and whatever else you may need. Set the criteria for each group as you create them.


~Brian
 
Create a formula that combines the field4's as appropriate, as in:

If {table.field4} in ["BOM","DEL","ALH","KER" then
"BOM/DEL/ALH/KER"
else
"MDR/CHN/PNJ"

Now group on this formula field.

It looks like you also want to eliminate duplicates under that grouping, so create a second formula field to group on containing:

{table.field1}+{table.field2}

Suppress the Details and display your records in the second group header or group footer.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top