×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • 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!

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

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Crystal reports Description contains bracket

Crystal reports Description contains bracket

Crystal reports Description contains bracket

(OP)
hello,

i need to show a part of a description, if the description is Testing (6) (with bracket) i need to show only the 6 in the bracket. any idea please?

RE: Crystal reports Description contains bracket

replace(replace({YourField},"(",""),")","")

Macola Software Veteran and SAP Business One Consultant on Training Wheels

Check out our Macola tools:

www.gainfocus.biz/exceladdin.html

RE: Crystal reports Description contains bracket

(OP)
Hi dgillz

thanks for your reply.

what i need is if a description is Testing (6) i need to remove the description Testing and Showing only the (6) and if possible without brackets. so the result should be 6 only.

RE: Crystal reports Description contains bracket

Will the data always be exactly what you put above, or is that just an example? The following will ignore whatever string precedes the opening bracket, and return everything from that point but excluding the brackets themselves.

CODE

REPLACE(REPLACE(MID({Table.Field}, INSTR({Table.Field}, '(')), '(', ''), ')', '') 

But if there are other patterns to the data it will not work. If the above code does not work you will need to explain all possible patterns.

Hope this helps.

Cheers
Pete.

RE: Crystal reports Description contains bracket

(OP)
hi Pete

thanks for your reply

i forgot to mentioned that the description is Testing (6) 451221 and i need to show only the 6 which are in the brackets - so i need to remove Testing () 451221

RE: Crystal reports Description contains bracket

The following code will return everything between the brackets.

CODE

Local numbervar start := INSTR({Table.Field}, '(');
Local numbervar end   := INSTR({Table.Field}, ')');
MID({Table.Field}, start + 1, (end - start - 1)) 

Cheers,
Pete

RE: Crystal reports Description contains bracket

(OP)
Hi Pete

you are super! many thanks

RE: Crystal reports Description contains bracket

(OP)
hi Pete,

if the description doesn't contains the ( Bracket in the description can i use "else" or "then" to showing the word "to fill" ? because i'm getting an error where the bracket is not available in the description.

thanks

RE: Crystal reports Description contains bracket

This is why you need to understand your data, and provide all the details at the outset.

CODE

Local numbervar start := INSTR({Table.Field}, '(');
Local numbervar end   := INSTR({Table.Field}, ')');

IF      start > 0
THEN    MID({Table.Field}, start + 1, (end - start - 1))
ELSE    {Table.Field} 

This will return the original contents of {Table.Field} when no opening bracket exists, and assumes there will always be a closing bracket whenever an opening bracket exists. Depending on what you want to happen when there is no '(' you might need to change the ELSE result.

RE: Crystal reports Description contains bracket

Just for the record those are parentheses not brackets.

Macola Software Veteran and SAP Business One Consultant on Training Wheels

Check out our Macola tools:

www.gainfocus.biz/exceladdin.html

RE: Crystal reports Description contains bracket

Just for the record, you're not helping.

RE: Crystal reports Description contains bracket

(OP)
thank you both now is working as i needed.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

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! Already a Member? Login

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