Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
NavinReddy
Creator II
Creator II

Remove Text between a brakets

Hello Dear Experts,

Good Evening

i'm trying to remove the word mentioned in brackets.

i have tried which i'm not able to achieve can some one help me. 

Actual Text:

% Month Review - % of accounts that qualified and receive a deprice (KDC3304 +Dynamic Tier+) %

$ Debit Card Gross Fraud Rate (BPS) (KXO2203 +Dynamic Tier+) #

$ Debit Fraud Detection Rate (%) (KXB10235) %

# Accounts charged-off outside policy timelines (KXO1410) #

Expecting Result:

% Month Review - % of accounts that qualified and receive a deprice %

$ Debit Card Gross Fraud Rate (BPS) #

$ Debit Fraud Detection Rate (%) %

# Accounts charged-off outside policy timelines #

please help me to resolve this issue

Thanks in Advance

Many Thanks,

Niranjan

1 Solution

Accepted Solutions
sunny_talwar

For 4 rows, may be this:

Table:

LOAD Field,

  Left(Field, Index(Field, '(', -1)-1) & Right(Field, Len(Field) - Index(Field, ')', -1) -1) as NewField;

LOAD * INLINE [

    Field

    % Month Review - % of accounts that qualified and receive a deprice (KDC3304 +Dynamic Tier+) %

    $ Debit Card Gross Fraud Rate (BPS) (KXO2203 +Dynamic Tier+) #

    $ Debit Fraud Detection Rate (%) (KXB10235) %

    # Accounts charged-off outside policy timelines (KXO1410) #

];


Capture.PNG

View solution in original post

9 Replies
sunny_talwar

Is this one data row or is this four rows of data?

adamdavi3s
Master
Master

I think any dynamic formula will struggle as you also have text inside brackets that you want to keep, but I am interested to see what Sunny comes up with as always 😉

sunny_talwar

Well, first things first we need to know that is this 4 different rows of data or single row with Chr(10)s or Chr(13)s

sunny_talwar

For 4 rows, may be this:

Table:

LOAD Field,

  Left(Field, Index(Field, '(', -1)-1) & Right(Field, Len(Field) - Index(Field, ')', -1) -1) as NewField;

LOAD * INLINE [

    Field

    % Month Review - % of accounts that qualified and receive a deprice (KDC3304 +Dynamic Tier+) %

    $ Debit Card Gross Fraud Rate (BPS) (KXO2203 +Dynamic Tier+) #

    $ Debit Fraud Detection Rate (%) (KXB10235) %

    # Accounts charged-off outside policy timelines (KXO1410) #

];


Capture.PNG

sasiparupudi1
Master III
Master III

Table:

LOAD   T1,

SubStringCount(  T1,')') as ind,

Replace(T1,        

        '('&

             TextBetween(T1,'(',')',

             SubStringCount(  T1,')'))

         &')'

        

         ,'')  as T2;

LOAD * INLINE [

    T1

    % Month Review - % of accounts that qualified and receive a deprice (KDC3304 +Dynamic Tier+) %

    $ Debit Card Gross Fraud Rate (BPS) (KXO2203 +Dynamic Tier+) #

    $ Debit Fraud Detection Rate (%) (KXB10235) %

    # Accounts charged-off outside policy timelines (KXO1410) #

];

NavinReddy
Creator II
Creator II
Author

Thank you very much Sunny, its working fine

Thanks again

NavinReddy
Creator II
Creator II
Author

Thank you Sasidhar,its working fine

antoniotiman
Master III
Master III

=Replace(Field, '('&SubField(Field,' (',-1),'')& Right(Field,1)

johnb023
Contributor III
Contributor III

This is a solution I was looking for.

I found that in the case where there were no brackets in the string, the first letter of the string was dropped.

I got around this by checking for brackets first...

if(SubStringCount(Field, '(') > 0 and SubStringCount(Field, ')') > 0  ...

There may be a more elegant solution.