Choose Language Hide Translation Bar
Community Trekker

deleting a column used in another column's formula

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.

0 Kudos
Super User

Re: deleting a column used in another column's formula

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));


0 Kudos
Staff (Retired)

Re: deleting a column used in another column's formula

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

0 Kudos