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

Concatenate Error 3

Status
Not open for further replies.

psamedy

Technical User
Apr 22, 2002
60
US
Hello

I'm trying to concatenate these fields. This is the formula i'm using.

"TIN#: "+ {PPO_DOCTOR.DOCTOR_PFX} +
(totext({PPO_DOCTOR.DOCTOR_NBR},0,"")) + {PPO_DOCTOR.DOCTOR_SFX}

I get message saying that a string is required before my last {PPO_DOCTOR.DOCTOR_SFX}. Please Help
 
what kind of field is {PPO_DOCTOR.DOCTOR_SFX} ?
have you tried using (totext({PPO_DOCTOR.DOCTOR_SFX}))? [americanflag] ShannonLea [americanflag]
 
& or + are fine, the problem may be that you're encountering a NULL, or one of the other data types isn't a string.

Try selecting File->Report Options->Convert Null Field Value to Default.

-k
 
Um, no either is not fine.
If you are trying to concatenate data types numbers and strings together, you need to use &
+ works fine for all strings.
I have a formula doing just that that I've tested it on.
 
Ahhh, I hadn't realized that you could use the & to concatenate various data types and return a resulting string, I always use the totext(), interesting...

A star for the lesson, schaf3, thanks.

I noted that it automatically includes 2 decimals and a thousands separator (possibly the default for numerics in the report), but note that their formula above is using a totext to zero the number of decimals and they have no thousands separator.

I'd suggest using the totext() and either concatenation method.

-k
 
Thanks for the input. I know have it working. Thanks again!!
 
Schaf3,

I've been using Crystal for 6+ years and I always used the totext() to convert numbers and dates and then used the + operator. Thanks for the tip.


Followup question, how do you keep from showing decimals with this method? Or do you have to use the totext() method to do this?
Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
dgilsdorf@trianglepartners.com
 
dgillz: I played with this yesterday and the only method I found was to set the default in the database, hence the suggestion to just use totext() to always assure the output.

-k
 
Thanks synapsevampire, the totext() method is probably the best bet. I also agree that it is the only way to keep from showing decimals. I don't like the idea of changing the report options to set null to default though.
This is what I had to do to get rid of the decimals.
totext({Liqras.Source_code},0,"")
 
Setting null to default has nothing to do with this. Though I almost always do as I resolve null issues in SQL, not in Crystal. Crystal being a slower engine with a mediocre language.

I was speaking of changing the default display of numerics for the report. Again, just use totext(), it's easier.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top