Solved

# When I add a second carriage return Char(13) to my formula, i get more than one extra space.

Posted on 2008-10-20
667 Views
I have the following formula:

(
if isnull({Interest_1}) then "" else
""+{Interest_1}
)
+
(
if isnull({Interest_2}) then "" else
chr(13) + ""+{Interest_2}
)

The formula works fine, however I want a little more space between Interest_1 and Interest_2. When I change the second statement to be

(
if isnull({Interest_2}) then "" else
chr(13) + chr(13)+""+{Interest_2}
)

I get what looks to be like 3 spaces between interest_1 and interest_2.  Anyone know what I'm doing wrong?  I can post I screenshot if someone needs to see it.
0
Question by:BostonMA
• 4
• 3

LVL 4

Author Comment

ID: 22758902
Here are two screen shots..
double-spacing.JPG
single-space.JPG
0

LVL 34

Expert Comment

ID: 22763517
What you have in your formula looks OK and I don't think you're actually getting any extra lines.  If you put the two pictures you posted side by side, the second line in the single-spaced picture falls right in the middle of the two lines in the double-spaced picture.  You could try putting two formulas side by side on your report, one with one ChrW (13) and one with two, and see how they line up.

It's not important, but, FWIW, I am wondering why you have "" in the strings after the "else"s (eg. ""+{Interest_1}).  You need "" after the "then"s, but they don't seem to serve any purpose in the strings after the "else"s.

James
0

LVL 4

Author Comment

ID: 22763897
Hi James,

Thanks for the comments, I guess the bottom line is I need to control the spaces to be somewhere between the first image and the second image.  Any ideas how to do that? Or is further refinement through a formula impossible? Ie instead of doing the spacing this way I should use a detail section for each Interest and conditionally supress each if its blank.
0

LVL 34

Accepted Solution

James0628 earned 500 total points
ID: 22763990
I was afraid you were going to say that.  :-)

In the format for a text field, you can go to the Paragraph tab and change the "Text interpretation" to RTF or HTML.  You can then do some fancier formatting by embedding control strings, like HTML tags, within the string.  I'm not sure if that will let you adjust the spacing between the lines in the string, but it might.  For example, you might be able to adjust the spacing that you get from the ChrW (13) by changing the font size before that, and then changing the font size back to normal before the next text field.  Changing the font size is just the first thing that comes to mind.  There may be better ways to handle this using either RTF or HTML tags.

Otherwise, you may have to fall back to using a separate detail section for each field.  If that will work for you, it might be the simplest solution.

James
0

LVL 4

Author Comment

ID: 22832284
I ended up resolving this by right clicking on the field, going to the format editor, paragraph, and changing the line spacing to a multiple of 1.25 times. That seemed to work.
0

LVL 4

Author Closing Comment

ID: 31507827
Thanks.
0

LVL 34

Expert Comment

ID: 22846952
Oh.  Duh.  Seems kind of obvious, now that you mention it.  :-)  That's just one of those settings in CR that I've never messed with.  Glad you found a solution, and thanks for letting us know what it was.

James
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

### Suggested Solutions

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…