BookmarkSubscribe
Choose Language Hide Translation Bar
swu2
Community Trekker

deleting row using contains

Hello,

 

I am using JMP 12.2.0, and I worte a script to delet rows that contain "n", "I", "%" and "S.D" in all open data table.

 

I run the script, it works the first time, and when I reboot my computer the script stop working and give me an error message on wrong argument type.

 

"argument is wrong type{1} in access or evaluation of 'Contains' , Bad Argument( As Column( dt, "Run Date" ) ), Contains/*###*/(As Column( dt, "Run Date" ), "n")".

 

This is my script, would someone please help?

 

For( i = 1, i <= N Table(), i++,

 

dt= Data Table( i );

Column(dt, 1 ) << set name( "Run Date" );

Column( dt, 2 ) << set name( "Run Number" );

dt<<select where (Contains (as Column (dt, "Run Date"),"n")

| Contains ( as Column (dt, "Run Date"), "I")

| Contains ( as Column (dt, "Run Date"), "%")

| Contains ( asColumn ( dt,"Run Date"), "S.D."))<<Delete Rows();

 

dtname =dt<<get name;

 

y=2*nrow(dt);

 

If (contains (dtname, "STD") , for (a=2, a< y, a+=4,dt<<Add Rows(2, a)));

);

 

 

0 Kudos
1 REPLY 1
David_Burnham
Super User

Re: deleting row using contains

Dates are represented by numbers so my guess is that your 'Run Date' column is numeric and you are testing to see if it contains characters. I've heard you shouldn't eat oysters until there is an 'R' in the month, but not sure why you would have a '%'.  On the basis that you do have date times that are formatted, you would need to do something like:

 

// select oyster-eating months
dt << select where( Contains( Format(AsColumn("Column 1"),"ddmonyyyy"), "R") );
-Dave
0 Kudos