cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
See how to use to use Text Explorer to glean valuable information from text data at April 25 webinar.
Choose Language Hide Translation Bar
View Original Published Thread

For loop -- delete row and formula in list

UserID16644
Level V

Hi all,

How can I iterate a delete formula then delete column using for loop in list?

Something like this:

col_formula = {"Column1", "Column2" };

col2_row = {"Column3", "Column4"};

For( i = 1, i <= N Items ( col_formula ), i++,
col_formula (i) << Delete Formula //delete formula

col2_row (i) << Delete Row//delete row
);
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: For loop -- delete row and formula in list

col_formula = {"Column1", "Column2"};
col2_row = {"Column3", "Column4"};

// This will delete the formula
For( i = 1, i <= N Items( col_formula ), i++,
	Column( col_formula[i] ) << Delete Formula; //delete formula
);

// You cannot delete a row within a given column.  JMP always has
// an equal number of rows for all columns.
// You can delete a row, but it will delete the row for all columns.

current data table() << delete rows( i );

// If you want to remove the value for a given row within a column,
// you can set the value to a missing value


 

Jim

View solution in original post

2 REPLIES 2
frank_wang
Level IV


Re: For loop -- delete row and formula in list

Hi

I thick this should be work expect your column format might incorrect.

cols={":col_1",":col_2"};
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Bank Loan.jmp" );
:Time << Delete Formula;
心若止水
txnelson
Super User

Re: For loop -- delete row and formula in list

col_formula = {"Column1", "Column2"};
col2_row = {"Column3", "Column4"};

// This will delete the formula
For( i = 1, i <= N Items( col_formula ), i++,
	Column( col_formula[i] ) << Delete Formula; //delete formula
);

// You cannot delete a row within a given column.  JMP always has
// an equal number of rows for all columns.
// You can delete a row, but it will delete the row for all columns.

current data table() << delete rows( i );

// If you want to remove the value for a given row within a column,
// you can set the value to a missing value


 

Jim