on ‎2008 Jul 21 6:35 PM
Hello all,
It has been quite some time since I've worked within Crystal reports! Following is my latest question:
When concatenating strings, is there anyway to make a line break? I am trying to make an address block, but I cannot figure out how to get the City/State on its own line without pulling the address line / city-state fields in separately.
Here is a snippet:
{mail.addr_1}' '{mail.addr_2} + ' '+ {@CityState}
I would like to see each field on its own line, but I do not want to place each field on its own because addr_2 is not guaranteed to have any value.
Note: @CityState is just a formula that combines City, State and Zip...
Thanks,
Holly C Schulz
Request clarification before answering.
I have tested the following formula:
{mail.addr_1} + (if not IsNull ({mail.addr_2}) then chr(13) + {mail.addr_2};) + {@CityState}
It works when there is no data for {mail.addr_2}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I know it's been a long time since this thread was active but this worked exactly as I needed. My problem is I need it to continue for 6 lines. When I created this it failed. With the addition of the Line 3 I am having blanks for addresses without a Line 2.
{@FamRegAddressLine1}+(if not IsNull ({@FamRegAddressLine2}) then chr(13) + {@FamRegAddressLine2};) + (if not IsNull ({@FamRegAddressLine3}) then chr(13) + {@FamRegAddressLine3};) + {@FamRegAddressLine4}
Can anyone help me with this?
Thank you so much,
Michele Booher
Hey Holly,
Create a new formula.
Write your formula (If IsNull(Add_2)or Add_2 = " " Then Whatever Else ...)
Output the results of the formula using HTML like:
stringvar i := "Hello";
"<center>C5 - " + i + " </i><br>". (The "br" for the line break won't show up in the thread,
but it goes right after i )
Place the formula on the report.
Right click the field / Format Field / Paragraph /Text Interpretation - "HTML Text"
This way you control just the output you want to see...all in one box.
Hope this helps,
The Panda
Edited by: pandabear on Jul 21, 2008 8:15 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I could most definitely add in extra sections, or even use a selection formula and concatenate the strings within the select statement.
I would still love to know how to add a line break when concatenating.
EXAMPLE:
{mail.addr_1}' '{mail.addr_2} + ' ' + {@CityState}
--Would return
1234 Sesame Street Place Suite 402 Jacksonville, FL 32242
--Need to see
1234 Sesame Street Place
Suite 402
Jacksonville, FL 32242
Please advise.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Holly,
To add a line break when concatenating strings in a formula, you can add a carriage return by entering the ASCII number 13 in the function "CHR".
For example, your formula will look like:
{mail.addr_1} + chr(13) + {mail.addr_2} + chr(13) + {@CityState}
Now, when adding the formula to your report, it will display the data like:
1234 Sesame Street Place
Suite 402
Jacksonville, FL 32242
Finally, make sure you check the formatting option "Can Grow" on the formula field to display all the information.
Holly
Maybe I don't understand your question..... but cant you just widen the details section and place address 1 and address 2 on top, then add city state below?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Holly Schulz,
Try placing each field in separate section by inserting new section below and check the option suppress blank section in the section expert for each section.
Raghavendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 7 | |
| 7 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.