×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

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!
  • Students Click Here

*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

Jobs

Conditional and Right Trim formula

Conditional and Right Trim formula

Conditional and Right Trim formula

(OP)
Hi,

We're looking for 2 formulas.

The first is a conditional one to determine whether the field named [venum] has 3 "_"s in it or not.

The second formula is to trim everything to the right of the 3rd "_" including the "_", in the field [venum]

For example, let's say [venum] contains a00100_fl_eu_0102753(a), we're looking for a result of a00100_fl_eu

CRX is in play.

Thank you for your assistance.
Lori

RE: Conditional and Right Trim formula

It isn't clear whether your data could ever have more than 3 '_' in it. Assuming, not, the following will work:

CODE --> {@Test}

WhilePrintingRecords;
If      UBound(Split({Table_Field}, '_')) = 4
Then    True
Else    False 

CODE --> {@Extract}

WhilePrintingRecords;
If      UBound(Split({Table_Field}, '_')) = 4
Then    Split({Table_Field}, '_')[4] 

Hope this helps.

Cheers

RE: Conditional and Right Trim formula

Sorry, just realised I misread the question. Try this for the second formula:

CODE --> {@Extract}

WhilePrintingRecords;
If      UBound(Split({Table_Field}, '_')) = 4
Then    Split({Table_Field}, '_')[1] + '_' +
        Split({Table_Field}, '_')[2] + '_' +
        Split({Table_Field}, '_')[3] 

Cheers

RE: Conditional and Right Trim formula

(OP)
I'll give that a try.
Thank you!

RE: Conditional and Right Trim formula

(OP)
Worked like a charm pmax9999.
Thanks so much!

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