Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5144 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

Hi, Is there a way to obtain any number of words e.g. 3, 4, 5 or 6 say which are to the left of an opening bracket ( or alternatively to the left of a 1,2,3 or 4-digit number/ Thx.

For example:

Green large t-shirt (some text here)

to obtain: Green large t-shirt

or

Green large t-shirt 234

to obtain: Green large t-shirt

Since there might be any number of words before the bracket is there a way to look for the start of the bracket and just keep the words to the left of it?

Edited by Guest
Posted

Try:

Left ( YourTextField ; Position ( YourTextField ; " (" ; 1 ; 1 ) - 1 )

Note: I put a space before the ( because your example had one.

HTH

Lee

Posted (edited)

or alternatively to the left of a four-digit number

If your field is named "myDataField" then...

Let(

[

fourDigitNum = Left(Filter(myDataField;“0123456789”); 4)

];

Case(

Length(fourDigitNum) = 4;

Trim ( Left ( myDataField ; Position ( myDataField ; fourDigitNum ; 1 ; 1 ) - 1 ) );

""

)

)

Edit:

To generalize this to 1, 2, 3, or 4-digit numbers...

Let(

[

fourDigitNum = Left(Filter(myDataField;“0123456789”); 4)

];

Case(

(Length(fourDigitNum) > 0) and

(Length(fourDigitNum) ≤ 4);

Trim ( Left ( myDataField ; Position ( myDataField ; fourDigitNum ; 1 ; 1 ) - 1 ) );

""

)

)

Edited by Guest
Posted

Right. I have a field which might look like this:

Green trousers (large)

Ignore the fact that the word in brackets is 3rd word from left but it is always last.

I want to be able to cut the word 'large' out of this and post it into another field.

Thx

Posted

This looks complicated. Suppose I had this:

green trousers (large size 2)

or black outdoor jacket (large size 2)

How would I trim away everything to the left of the bracket "(". Then I could just substitute the () with blanks and post what remains??

Posted

These solutions worked well but the first was sufficient:

Trim ( Left ( text ; Position ( text ; "(" ; 1 ; 1 ) - 1 ) ).

Is there a way I could use this so that I would be left with what I originally discarded?

For example:

Green large t-shirt (some text here)

to obtain: (some text here)

Thx.

Posted (edited)

Using comment's calculation, but modified to fit your need.


Let ( [

start = Position ( YourTextField ; "(" ; 1 ; 1 ) + Length ( "(" ) ;

end = Position ( YourTextField ; ")" ; start ; 1 )

] ;

Middle ( YourTextField ; start ; end - start )

)

Edited by Guest
Posted

To include the brackets, then modify it like this.


Let ( [

start = Position ( YourTextField ; "(" ; 1 ; 1 ) + Length ( "(" ) ;

end = Position ( YourTextField ; ")" ; start ; 1 )

] ;

"("  & Middle ( YourTextField ; start ; end - start )  & ")"

)

  • 2 weeks later...
Posted

Tried but not succeeded at also trimming everything away to the right of the '(' - another use, and including the '(' itself.

So;

t-shirt red $40 (small) would yield:

t-shirt red $40

The content of the brackets constantly changing the only universal constant is the existence of the bracket itself. Thx.

Posted

No, not thanks.

You either have changed what you are describing as you need, or the calculations should work.

Left ( YourTextField ; Position ( YourTextField ; " (" ; 1 ; 1 ) - 1 )




will give you [color:blue]t-shirt red $40



and


Let ( [

start = Position ( YourTextField ; "(" ; 1 ; 1 ) + Length ( "(" ) ;

end = Position ( YourTextField ; ")" ; start ; 1 )

] ;

"("  & Middle ( YourTextField ; start ; end - start )  & ")"

)

will give you [color:blue](small)

Lee

This topic is 5144 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.