Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Can Grow - Selecting the character to wrap at Post Reply Post New Topic
Author Message
hoffy
Newbie
Newbie


Joined: 11 Nov 2009
Location: Australia
Online Status: Offline
Posts: 2
Quote hoffy Replybullet Topic: Can Grow - Selecting the character to wrap at
     Posted: 11 Nov 2009 at 8:50pm
Hi, I am new around this parts, so please be kind!
 
I am using CR 10 (Sp2) and I have come across a small problem that I am having trouble with, so I am hoping that someone may be able to help me.
 
The issue I am having is with a data field (varchar data type) with "Can Grow" set, that is starting the new line at the wrong place.  The data structure looks similar to this (what is returned is variable in length):
 
xxxxxxxxxxx xxxxxx-xxx.xxx.xxx
 
What is happening is that if the report returns a string that is too long for the field, where the break point is before the space, it breaks at the nearest non alpha character.  I.E.:
 
xxxxxxxxxxx xxxxxx-xxx.xxx.
xxx
 
What I would like it to do is break at the space character, I.E.:
 
xxxxxxxxxxx
xxxxxx-xxx.xxx.xxx
 
Does anyone know of an easy way I can do this?
 
Thanks (hopefully) in advance
 


Edited by hoffy - 11 Nov 2009 at 8:53pm
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 12 Nov 2009 at 5:28am
If there is always a space separating the information try this:
 
split({table.field}, ' ')[1]
& chr(13)
& split({table.field}, ' ')[2]
 
Set the field to can grow or just increase the hight of the field.
 
Let me know if that helps.


Edited by FrnhtGLI - 12 Nov 2009 at 5:29am
IP IP Logged
hoffy
Newbie
Newbie


Joined: 11 Nov 2009
Location: Australia
Online Status: Offline
Posts: 2
Quote hoffy Replybullet Posted: 22 Nov 2009 at 9:16pm
An update (just in case anyone cares how this ended up).
 
My example above wasn't quite clear enough.  There could be multiple words with multiple spaces (not just the one as described).
 
In the end, what I ended up doing is as follows:
Local StringVar RevDescrip := StrReverse({table.field});
IF Length({table.field}) > 50
Then
StrReverse(Split (RevDescrip,' ',2)[1] & chr(10) & Split (RevDescrip,' ',2)[2] )
ELSE
{table.field};
 
I ended up using a chr(10) (line feed), as the way we output these didn't work with a carraige return.
 
Thanks!
IP IP Logged
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