BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
dale_lehman

Community Trekker

Joined:

Jan 29, 2015

Solution

Re: Scanning a Description

I believe I was correct in my earlier comment.  Your formula needs to have the complete "Contains()" function after each "OR" statement.  I've attached what I suggested and it appears to do what you want.

llawless

Community Trekker

Joined:

Aug 12, 2015

Re: Scanning a Description

Thank you.  I did not enter the or command correctly previously.

uday_guntupalli

Community Trekker

Joined:

Sep 15, 2014

Solution

Re: Scanning a Description

@llawless
  I used the same script on your data table and here are the results . 

 

image.png

 

dt = Current Data Table(); // Keep your data table open. 


dt << New Column("Test",Character,Continuous,Formula(If( !Is Missing( Regex( Char( :Description ), "oz" ) ) | !Is Missing( Regex( Char( :Description ), "ounce" ) ),:Description,"No Match"))); 
Best
Uday
llawless

Community Trekker

Joined:

Aug 12, 2015

Re: Scanning a Description

Thank you!

 

 

dale_lehman

Community Trekker

Joined:

Jan 29, 2015

Re: Scanning a Description

I could be wrong, but don't you need an OR statement inside of the contains function?  If I am right, then the absence of OR is just looking for that entire string of entries and not finding them all at once.  But I might be wrong.

ih

Community Trekker

Joined:

Sep 30, 2016

Re: Scanning a Description

Another way:

New Column( "40 oz",
	Numeric,
	"Nominal",
	Format( "Best", 12 ),
	Formula( N Items( Regex Match( :Description, "40.*[oO]([zZ]|unce)" ) ) > 1 ),
	Value Labels( {0 = "No", 1 = "Yes"} ),
	Use Value Labels( 1 ),
	Set Display Width( 57 )
);