Crystal Reports (4.6.1): String Concatenation in a formula

I have a Crystal Report where I have a Formula field.  The formula field simply concatenates two text fields from the database. My function bombs when the total length of the concatenated string goes beyond 254.  I get an error saying that string cannot be more than 254 characters.  How can I solve this problem?

An early response would be greatly appreciated.

Thanks
jychAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
vbkecoConnect With a Mentor Commented:
Thanks jych, I assume it fixed your problem?
0
 
jfleminCommented:
Left ({Field1}+{Field2},254 )
0
 
vbkecoCommented:
You need to first check the length of each field in your Crystal Report.  In jflemin's example, if their combined length is greater than  254 characters you'll lose some data from Field2.  If that happens, try trimming the blanks off the end of each field first, check the new field lengths, then combine them.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
jychAuthor Commented:
What if the total VALID length is more than 254?  What should I do then?
0
 
vbkecoCommented:
You still need to know the TOTAL length of the fields.  Lets say, for example, that the total length of each field is as follows:

Field1 = 175 characters long, and
Field2 = 200 characters long.  

Their combined total is 375 characters.

Use the following statements in your subroutine:

Dim Field1 as String * 175
Dim Field2 as String * 200
Dim NewField as String * 375

NewField = Field1 + Field2

Hope it works!
vbkeco
0
 
jychAuthor Commented:
I like vbkeco's answer better.  How would you get the points?
0
All Courses

From novice to tech pro — start learning today.