Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Returning text in 2 different lines Post Reply Post New Topic
Author Message
Goldberg
Groupie
Groupie
Avatar

Joined: 15 Apr 2011
Location: Portugal
Online Status: Offline
Posts: 58
Quote Goldberg Replybullet Topic: Returning text in 2 different lines
     Posted: 21 Jun 2012 at 11:13pm
Hello,

I have a form on CR that returns personal info of a student's school.
On a specific part, I have something like:

" <name> , from <city>, with the number <number>, son of <fathersname> and <mothersname>, lives in <address>
(....) "

The text is way bigger, but the thing is, the adress sometimes is very long.

Is it possible to return the address in two different lines?
Like this:
"........................................., lives in Street of Santiago, nº 40
4000-555 Town, Portugal......................................................"

Thanks :)



IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 21 Jun 2012 at 11:49pm
Will the field always contain "lives in" and commas after each line of the address? Also, is there anything after the address?
 
You could do something like this but it's quite volatile if the field doesn't match all the criteria;
 
 
stringvar x:= {table.field};
numbervar as:= instr(x,"lives in", 1) + 8;
numbervar spl:= instr(as,x,",",1)+1;
stringvar l:= left(x,spl);
stringvar r:= mid(x,spl);
l & chr(13) & r
 
Regards,
Ryan.
IP IP Logged
Goldberg
Groupie
Groupie
Avatar

Joined: 15 Apr 2011
Location: Portugal
Online Status: Offline
Posts: 58
Quote Goldberg Replybullet Posted: 22 Jun 2012 at 12:29am
"lives in" is a static text. The "Street of Santiago, nº 40, 4000-555 Town, Portugal" is what the adress field returns. There is always one comma between the Street and Door number, but it is all in the same field. The field itself already contains the comma
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