cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Dennisbur
Level IV

Delete column by scipt

Hello

I have written a script for deleting the column "Missing(Result)" in the table

My problem is that sometimes I do not have the column "Missing(Result)" and I'm receiving an error at this moment.

Can you assist me with what I need to add to my script that will delete the column if it exists in my table.

And if it doesn't exist, just skip this request?

 

Dennisbur_0-1675099605619.png

dt << delete column (column ("Missing(Result)"));

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Delete column by scipt

Use << Get Column Names(String) to get list of column names and then if statement with Contains to check for the specific name

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
col_names = dt << Get Column Names(String);

If(Contains(col_names, "Missing(Result)"),
	dt << Delete Columns("Missing(Result)")
);
-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: Delete column by scipt

Use << Get Column Names(String) to get list of column names and then if statement with Contains to check for the specific name

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
col_names = dt << Get Column Names(String);

If(Contains(col_names, "Missing(Result)"),
	dt << Delete Columns("Missing(Result)")
);
-Jarmo

Recommended Articles