Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Bracket problem Post Reply Post New Topic
Author Message
JohnS
Newbie
Newbie


Joined: 09 Feb 2012
Location: Netherlands
Online Status: Offline
Posts: 2
Quote JohnS Replybullet Topic: Bracket problem
    Posted: 09 Feb 2012 at 10:40pm
DESCRIPTION:
In Crystal Reports v11 we build a report. This report contains a VarChar2 database field. The string from the database is too long to fit in one line of the field, so it breaks somewhere at the end of the “visible” string (the right side of the text field). The part after the line break is shown on the second line in the field. So far, so good (example 1).
Now we have a string which contains a closing and an opening bracket. In this scenario the string will break exactly between the closing and an opening bracket. Even if the brackets are at the beginning of the string. In that case the line space on the first line is hardly used (example 2). This scenario is valid for both round and square brackets and a combination of bracket types.
 
Example 1
------------------------
Original string without brackets:
“This is a long string. This is a long string. This is a long string. This is a long string. This is a long string. This is a long string. This is a long string. This is a long string.”
 
Actual and expected appearance in text field:
“This is a long string. This is a long string. This is a long string. This is a long string. This is a long
string. This is a long string. This is a long string. This is a long string.”
------------------------
 
Example 2
------------------------
Original string with brackets:
“This is a (long)(string). This is a long string. This is a long string. This is a long string. This is a long string. This is a long string. This is a long string. This is a long string.”
 
Actual appearance in text field:
“This is a (long)
(string). This is a long string. This is a long string. This is a long string. This is a long string. This is a long string. This is a long string. This is a long string.”
 
Expected appearance in text field:
“This is a (long)(string). This is a long string. This is a long string. This is a long string. This is a
long string. This is a long string. This is a long string. This is a long string.”
------------------------
 
QUESTION 1:
In the second example, what can we do to make the line break as in the “Expected appearance”?
 
QUESTION 2:
Are there any more characters for which this scenario (example 2) is valid?
 
 
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 09 Feb 2012 at 11:09pm
You could try making a formula like the following and using that in your details section rather than the database field;
 
Replace({table.longstringfield},ChrW(13),"")
 
Let me know how it goes and if it works as I'm not certain it will.
 
Regards,
Ryan.
IP IP Logged
JohnS
Newbie
Newbie


Joined: 09 Feb 2012
Location: Netherlands
Online Status: Offline
Posts: 2
Quote JohnS Replybullet Posted: 09 Feb 2012 at 11:38pm
Hi Ryan,
 
Unfortunately, this isn't the solution. It still shows the same problem.
 
The string containts no white spaces, it looks like this:
 
29~32<n>,X,+X,+2,+5,+8,del(18)(q24),+13,+18,+19,+21,+22[cp6]/52~62<2n>,XY,+X,+1,+5,+8,del(10)(q26)x2,+13,+17,+18,+19,+19,+21,+21,+22,+22[cp7]/46,XY[14]
 
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 10 Feb 2012 at 12:25am
Hmm it's caused because a close bracket is classed as sort of a space which Crystal thinks is ok to put a linebreak after when there's no other available spaces.
 
There's 2 ways around it, you can replace all the brackets with a character which Crystal won't allow spaces after, or you can insert your own spaces for Crystal to use which would make it use up a lot more of the available space.
 
I'd probably do the following;
 
replace({table.longstringfield},",",", ")
 
Regards,
Ryan.
 
EDIT: If you didn't want to insert spaces after every comma you could also determine a number of characters to show on 1 line and insert a space after that many characters, eg;
 
left({table.longstringfield},100)
& " "
& mid({table.longstringfield},101,100)
& " "
& mid({table.longstringfield},201,100)
 
Just keep adding to that if your fields are longer than 300 characters.
 
Hope the above helps.


Edited by rkrowland - 10 Feb 2012 at 12:30am
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.000 seconds.