Subscribe Bookmark RSS Feed

deleting a column used in another column's formula

hardner

Community Trekker

Joined:

Nov 13, 2012

I want to delete a column in a script but it's possible the user has created columns that refer to it in formulas (since the script is one embedded in data so a user can run it over and over again interactively alongside their own work with the data).

If I knew what those columns were I could delete the formula, or the column. (as I'm doing with columns I explicitly created in my script in the first place).

What I'm wondering is whether there is an easy to way to identify all such columns  - JMP just know it because when you try to do this manually it conveniently gives you an option to remove the formulas from those columns.  My table has over 1000 columns so I could do something very slow to get all the formulas and search through them but wondering if there is any easier way based on what JMP does when you try this interactively.

2 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

I am not aware of any such cross reference list, however, you can keep from erroring out, and still delete all of the columns that you can by looping across the columns you want to delete, and then using a Try function, and delete only one column at a time, you will accomplish what you want.

dt=current data table();

ColumnstobeDeletedList = {...........];

For(i=1,i<=N Items(ColumnstobeDeletedList),i++,

     Try(dt<<delete columns(ColumnstobeDeletedList));

);

Jim
Craige_Hales

Staff

Joined:

Mar 21, 2013

Head Arg Recurse Formula might be part of what you are looking for. 

Craige