×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• 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.

# 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.

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.

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:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!