Hi,
I am new to JSL scripting and was wondering how can I get JMP to pop up a window to display how many cols were deleted.
My code to delete cols is shown below:
dt = Current Data Table();
For( i = N Col( dt ), i >= 1, i--,
If( (Col N Missing( Column( i ) ) / N Row()) == 1,
dt << delete columns( i )
)
);
Here is one way
Names Default To Here( 1 );
dt = Current Data Table();
count = 0;
For( i = N Col( dt ), i >= 1, i--,
If( (Col N Missing( Column( i ) ) / N Row()) == 1,
dt << delete columns( i );
count++;
)
);
New Window( "Message", modal,
H List Box(
Spacer Box( size( 5, 0 ) ),
Text Box( Char( count ) ),
Text Box( " Columns Were Deleted" )
)
);
Here is one way
Names Default To Here( 1 );
dt = Current Data Table();
count = 0;
For( i = N Col( dt ), i >= 1, i--,
If( (Col N Missing( Column( i ) ) / N Row()) == 1,
dt << delete columns( i );
count++;
)
);
New Window( "Message", modal,
H List Box(
Spacer Box( size( 5, 0 ) ),
Text Box( Char( count ) ),
Text Box( " Columns Were Deleted" )
)
);
Adding to Jim's approach, this code uses the caption command to show what columns are being deleted. If the table is small the caption messages will flash by very quickly, but for larger tables it will give users an idea of progress.
Names Default To Here( 1 );
dt = Current Data Table();
count = 0;
nr = nrows(dt);
nc = ncols(dt);
For ( i = nc, i >= 1, i--,
If ( Col N Missing( Column( i ) ) == nr,
col_name = column(i) << get name;
caption("Deleting column " || col_name);
wait(0);
dt << delete columns( i );
count++;
);
);
// Remove the caption box
caption(remove);
wait(0);
New Window( "Message", <<modal,
Text Box( Char( count ) || " Columns were deleted" )
);