cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
BladeRunner
Level II

Deleting a row based on the presence of specific words in a cell

Hello All!  I think this might be a common situation for many working with data files from various instruments. My data sets are derived from stitching multiple output files from a specific instrument.  Besides the useful data rows, there are a number of rows on top of each output file that specify the Recipe, File, and others, typically, this info is in Column 1.  For processing the data, I do not need that info, so I want to delete the unnecessary rows containing the above words Recipe, File, etc. in the cells in Column 1.  Note that there might be other words in the same cells, for example: "Wafer Recipe Name", or "Stage Group File", etc.  I tried a number of permutations on the following, but I always get an error message saying: "Send expects scriptable objects in access of evaluation of "Send", etc.  Many thanks in advance!

 

dt_new2 << get rows where (contains (:Column 1, "Recipe"));
dt_new2 << delete rows;
Wait(1);

 

dt_new2 << get rows where (contains (:Column 1, "File"));
dt_new2 << delete rows;
Wait(1)

2 REPLIES 2
txnelson
Super User

Re: Deleting a row based on the presence of specific words in a cell

Try this

Names Default To Here( 1 );
dt_new2 = Current Data Table();
dt_new2 << select where( Contains( :Column 1, "Recipe" ) );
dt_new2 << delete rows;
Wait( 0 );

dt_new2 << select where( Contains( :Column 1, "File" ) );
dt_new2 << delete rows;

The Scripting Index

     Help=>Scripting Index

is a great source of statement syntax and examples.

Also, I advise you to take the time to read through the Scripting Guide found in the JMP Help

 

Jim
jthi
Super User

Re: Deleting a row based on the presence of specific words in a cell

If you wish to just use << Delete Rows without any arguments, you have to select rows (like Jim did show). Other option is to collect your rows into a variable and use that (my preferred method as it skips "unnecessary" row selection but selection is more visual if you wish to debug)

Names Default To Here(1);

rows_to_delete = dt_new2 << get rows where(Contains(:Column 1, "Recipe"));
dt_new2 << delete rows(rows_to_delete); 

rows_to_delete = dt_new2 << get rows where(Contains(:Column 1, "File"));
dt_new2 << delete rows(rows_to_delete);

This behaviour is not documented in Scripting Index,

jthi_0-1723608431578.png

but it can be found from JSL Syntax Reference Data Table Messages (jmp.com) and Scripting Guide Delete Rows (jmp.com) (search Delete Rows from Script Editor and press Topic Help)

-Jarmo