Subscribe Bookmark RSS Feed

How can I judge value cell and modify it in JMP script?

Sorry! I’m a beginner in JSL.


I want to judge value of cell it will be deleted if it was not I want in cell.


Such as : if( {column[4] ,row[5]} =1 , column[4],row[5]->will be deleted) ,


How can I do?

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Chris,

If you want to test a cell value and then delete the cell value you can use something like this:

dt = current data table();

for (i = 1, i <= nrows(dt), i++,  // Loop over all column 4 values
    if (column(4)[i] == 1,

    // then

        column(4)[i] = .; // Numeric "null"

    );

);

4 REPLIES
wiebepo

Community Trekker

Joined:

Oct 10, 2011

There are a number of ways to use criteria to delete rows. Here is a solution to the example shown:

::data_table=currentdatatable();

If(column(::data_table,4)[5]==1, ::data_table<<deleterows(5));

Solution

Chris,

If you want to test a cell value and then delete the cell value you can use something like this:

dt = current data table();

for (i = 1, i <= nrows(dt), i++,  // Loop over all column 4 values
    if (column(4)[i] == 1,

    // then

        column(4)[i] = .; // Numeric "null"

    );

);

Thank you for your answer

You help me solve a knotty trouble.

gbu

Community Trekker

Joined:

Jun 23, 2011

Maybe something like this :

RowsToDelete = dt << Get Rows Where(:COLUMN_NAME = 4);

dt << Delete Rows(RowsToDelete);

Regards,

Guillaume