Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Trimming a Field using an Expression

Hi Guys,

I am using the below expression to return a Descriptive line from a bill:

Only({< DESCR_ON_BILL={"Sing*"}, ACCT_ID={123456789A}>}DESCR_ON_BILL

Which returns the full field as below

Singing Bear ¬72¬ Toy¬@¬€0.14¬

But I just want the expression to return the 0.14 value. However, I am not sure how to use the trim function within my current expression?

I cant change my load script as I need the full field in another part of the report so it would have to be through the expression.

Any help would be great,

cheers

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Another possible solution:

=Textbetween( Only({< DESCR_ON_BILL={"Sing*"}, ACCT_ID={123456789A}>}DESCR_ON_BILL) ,'€','¬')

View solution in original post

4 Replies
swuehl
MVP
MVP

You can use subfield to extract the value:

=SubField(Only({< DESCR_ON_BILL={"Sing*"}, ACCT_ID={123456789A}>}DESCR_ON_BILL) ,'¬',-2)

avinashelite

if the position of the dollar values i.e. 0.14   is fixed , than you cant use the sub field function with the offset value

subfield(s, 'delimiter' [ , index ] )

In its three-parameter version, this script function returns a given substring from a larger string s with delimiter 'delimiter'. index is an optional integer denoting which of the substrings should be returned. If index is omitted when subfield is used in a field expression in a load statement, the subfield function will cause the load statement to automatically generate one full record of input data for each substring that can be found in s.

In its two-parameter version, the subfield function generates one record for each substring that can be taken from a larger string s with the delimiter 'delimiter'. If several subfield functions are used in the same load statement, the Cartesian product of all combinations will be generated.

Examples:

(For three parameters)

subfield(S, ';' ,2) returns 'cde' if S is 'abc;cde;efg'

subfield(S, ';' ,1) returns NULL if S is an empty string

subfield(S, ';' ,1) returns an empty string if S is ';'

swuehl
MVP
MVP

Another possible solution:

=Textbetween( Only({< DESCR_ON_BILL={"Sing*"}, ACCT_ID={123456789A}>}DESCR_ON_BILL) ,'€','¬')

Anonymous
Not applicable
Author

This seems to work perfectly. Thank you