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

combining character fields

Status
Not open for further replies.

mdtimo

Programmer
Oct 18, 2001
38
US
I have two tables. One with the expense incurred and another with the desciption of the expense.

they might look something likes this.

table 1
index
amount

table 2
index
line number
description

I link the two tables with the index.

With a longer description I might have two or more line numbers

so the data would look like this

table 1
index 1
amount $2.00

table 2
index 1
line number 1
description 20 min phone call from ext 5625 to

index 1
line number 2
desciption Apex Inc.

What I want to do is print the desciption and the amount on one line but can't find a way to merge to the two desciption fields.

I can get it to print as follows
20 min phone call from ext 5625 to $2.00
Apex Inc.

By grouping on the index # and supressing the detail if the line number is greater than 1, and having the desciption and detail in the header and only the desciption in the detail.

But I want it to look as follows
20 min phone call from ext 5625 to Apex Inc. $2.00

Any ideas?
 
Create a formula and put the two fields in it thus:

{table2.descrip}+" "+{table1.amount}

Then insert the formula in your report. Learn something new every day *:->*
 
I don't see how that helps the two description fields I am looking to combine are in different records but linked to the other table from one index. I am looking to merge the description fields not the amount and the desciption field.
 
I suppose your long descriptions are in two (or more) separate records. In that case, group on {index} and create three formulas to concatenate the {description}s using a global variable:

Formula ResetDesc: stringVar strDesc := ""
Place this formula in the {index} Group Header.

Formula ConcatDesc: stringVar strDesc;
strDesc := strDesc & " " & {description}
Place this formula on the detail line.

Formula ShowDesc: stringVar strDesc;
trim(strDesc)
Place this formula in the {index} Group Footer along with the {Amount} field.

Suppress the Group Header and Details sections.
The global variable (stringVar strDesc) must be declared in each formula. Note the use of ":=" for assignment.
 
There is a set of formulas for appending consecutive strings in faq149-243 . This formula will also make sure you don't error when/if the string goes over 255. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top