Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional and Right Trim formula

Status
Not open for further replies.

meagain

MIS
Nov 27, 2001
112
CA
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
 
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]

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

Hope this helps.

Cheers
 
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]
[/Code]

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top