Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I signed up to your site to get help with a problem and I am so glad I did. I found the help I needed immediately. Thanks to all who contribute to your site..."

Geography

Where in the world do Tek-Tips members come from?
justine92 (TechnicalUser)
7 May 12 17:59
Hi --

I'm fairly new to crystal report development.  I have a report that requires to display line 4 of an existing text field.  Is there a formula that will allow you to show a specific line from a text field?  There would be no blank lines in this case.

Any help would be great!  
lbass (TechnicalUser)
7 May 12 22:21
You could try a formula like this:

stringvar array x := split({table.text},chr(13));
if ubound(x)>=4 then
x[4]

-LB
justine92 (TechnicalUser)
8 May 12 10:59
I tried the formula but it didn't work.  But, I took the formula and changed it to:

stringvar array x := split({TW_V_COMMENTS.TEXT},chr(13));  ubound(x)>=4

which, this showed a 'true' 'false' display, indicating that there was data on line 4.  

Is there a function that can be included in the formula that would display the actual value instead of the true/false?

 
lbass (TechnicalUser)
8 May 12 21:58
What did you see when you used my formula? In what way did it not work?

Please show the values of a couple of text fields and the corresponding formula results to illustrate what is going on.

-LB
justine92 (TechnicalUser)
10 May 12 13:35

Thanks, BTW, for your reply.

When I used the formula you sent me, the report showed a blank space where I dropped the formula in the design tab. So, I changed it the formula I referenced above, and it gave me a true/false value instead (meaning, 'true' if there was value on line 4 and 'false' if there wasn't).

So, the text field I'm using has this information in it as an example:

Site Name
Department Name
Department Area
San Jose
Costa Rica

I need the report to print line 4 which will give me the city name. Is this possible to write in a formula?

I appreciate your help! Thanks!

lbass (TechnicalUser)
11 May 12 16:19
My formula should have worked, unless the text isn't using chr(13) for line breaks.

Please add a test formula and let me know the results:

instr({table.text},chr(13))<>0

If the answer is false, then substitute chr(10) (line feed) for chr(13).

Also please verify whether the text is single-spaced. If there were two returns at the end of a line, you would get the incorrect results.

The other test that would help would be if you provide sample text and then add the formula and substitute numbers for the subscript, e.g., replace 4 with 3 in two places and then report back (repeat with other numbers):

stringvar array x := split({table.text},chr(13));
if ubound(x)>=3 then
x[3]

-LB

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close