Turns out I did already submit something of this nature to the JMP wish list, and was in touch with JMP support (no clear solution as of yet, but a workaround I haven't had time to integrate quite yet).
Wish List item: Dynamic formula removal
A couple work around options from my chats with JMP support.
Names Default to here(1);
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
dt << New Column( "Test 1", Numeric, Formula( :height + :weight ) );
dt << New Column( "Test 2", Numeric, Formula( :height + :age ) );
keepCols = AssociativeArray({"name","Test 1","sex"});
formList = {};
formCols = {};
for(i=1,i<=ncol(dt),i++,
if(IsEmpty(Column(dt,i) << get formula),
Empty()
,
insertInto(formList,Column(dt,i) << get formula);
insertinto(formCols,i);
);
show(formList,formCols)
);
existingCols = dt << get column names(string);
For(i=1,i<=nitems(existingCols), i++,
there = keepCols[existingCols[i]];
If(there == 0,
for(j=1,j<=nitems(formList),j++,
nowCol = existingCols[i];
If(Contains(char(formList[j]),nowCol) > 0,
Print(nowCol);
//show(formCols[j]);
Try(Column(dt,formCols[j]) << delete formula);
,
Empty()
)
);
//dt << delete columns(eval(existingCols[i]))
)
);
For(i=1,i<=nitems(existingCols), i++,
there = keepCols[existingCols[i]];
If(there == 0,
dt << delete columns(eval(existingCols[i]))
)
);
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
dt << New Column( "Test 1", Numeric, Formula( :height + :weight ) );
colList = {:age, :height, :name};
colListStr = {"age", "height", "name"};
failed = {};
//dt << Delete Columns( :age ); //works
//dt << Delete Columns( colList[1] ); //fails
//dt << Delete Columns( Column( colListStr[1] ) ); //works
For( i = 1, i <= N Items( colList ), i++,
//dt << Clear Column Selection;
//colList[i] << Set Selected;
str = "";
//str = Log Capture( dt << Delete Columns( colList[i] ) ); //fails
//str = Log Capture( dt << Delete Columns() ); //works for selected columns
str = Log Capture( dt << Delete Columns( Column( colListStr[i] ) ) ); //works
Show( str );
If( str != "",
Insert Into( failed, colList[i] )
);
);
Show( failed );