Print Page | Close Window

Concatenating Fields and Label

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=6865
Printed Date: 05 May 2024 at 11:14pm


Topic: Concatenating Fields and Label
Posted By: Baillie11
Subject: Concatenating Fields and Label
Date Posted: 25 Jun 2009 at 6:31pm
Hi all, im hoping someone can help here.

I am developing a report that will display text, then I want to add a label centered in the report then add more text it.

I initially added a field (Field1) then a label then another field (Field2), BUT if the original Field's text was too long, its text would display over the top of the label (and possibly field2 also).

My first thought is to concatenate the 3 elements but I cant see how to do that with a label (I can certainly do it without any problems when its just the fields).

Can anyone suggest a solution??

I am happy to look at other solutions that do not involve concatenation.


THANK YOU ALL in advance for your suggestions.



Replies:
Posted By: DBlank
Date Posted: 25 Jun 2009 at 8:24pm
you can use a text object and type your labels then insert the databse fields into it
or
create a formula field just using " " around your labels and add your fields in where you want (assuming your db fields are text else you need to convert them to text) here is a sample:
"I am label 1: " + {table.field1} + "  This is label 2: " + {table.field2} + " Label 3: " + {table.field3}


Posted By: Baillie11
Date Posted: 25 Jun 2009 at 8:47pm
Thanks DBlank my first preference is your first suggestion, but HOW do I insert fields in a text object??

Im sorry if this is a dumb question.

Thank you though for your help.


Posted By: DBlank
Date Posted: 25 Jun 2009 at 9:15pm
No worries,
Just drag and drop. YOu will see a pipe appear where it will be dropped into the text.
Sometimes it is easier to expand the text object to a really large field so you can see all of it.  Long table or field names make it a pain to see what is going on or where in the string you are actually dropping a field. Once you have it in the correct sequence shrink it back to the size for displaying.
 
in design mode you end up with a text object that looks like
Name: {table.fname} {table.mname}. {Table.lname} Address: {table.address} ...
 
in preview mode you end up with a text object that looks like
Name: Jane M. smithe Address: 1234 Main street ...



Print Page | Close Window