Tips and Tricks
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Tips and Tricks
Message Icon Topic: How to divide the field,depending on number lines Post Reply Post New Topic
Author Message
denhors
Newbie
Newbie
Avatar

Joined: 04 Jan 2011
Online Status: Offline
Posts: 20
Quote denhors Replybullet Topic: How to divide the field,depending on number lines
    Posted: 25 Jan 2011 at 3:04am
I have a report with more details how split the field from the database that begins in the Detail a to continue after specified number of lines in the second detail, and then in the third ... (1 field - more details)
Example:
I need to split the field with 100 lines to 3 detail;
Detail a: 1 to 40 lines
Detail b: 41 to 80 lines
Detail c: 81 to end.
Thx


Edited by denhors - 25 Jan 2011 at 3:11am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 25 Jan 2011 at 3:22am
3 formula:
 
first40:
LEFT({table.field}, 40)
 
middle40:
MID({table.field}, 41, 40)
 
last20:
MID({table.field}, 81)
 
place each formula in the correct detail section and you should be done.
 
HTH
IP IP Logged
denhors
Newbie
Newbie
Avatar

Joined: 04 Jan 2011
Online Status: Offline
Posts: 20
Quote denhors Replybullet Posted: 26 Jan 2011 at 12:06am
Thanks for your reply, but I need a separating by lines (rows), this is by number of characters.
If you have an idea, feel free to share with me;)
Example fields:
1 line
2 lines
:
.
100 lines


Edited by denhors - 26 Jan 2011 at 12:07am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 27 Jan 2011 at 3:09am

sorry, missed the lines part

well, then my solution would be to count the carriage return/line feeds and use that to split the lines up.  You would probably want to keep a counter so that you don't keep recounting the lines.  You would want to use a loop, probably a WHILE loop (I don't use loops too often, so look in CR help for the syntax).  Your other friend will be INSTR to find the position of the carriage return/line feed( CHRW(13) +  CHRW(10) ).
 
HTH
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.020 seconds.