cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.
  • JMP will suspend normal business operations for our Rest and Recharge Day on Friday, October 2, 2026.
    Regular business hours will resume on Monday, October 5, 2026.

Discussions

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

Deleting Duplicate Scripts

Hello,

I have concatenated multiple files into a database which has lead to a database with many duplicated scripts. Is there a way to write a script to remove duplicated scripts? I don't want to delete them manually as I will add more files to the database with concatenation in the future which would again add the scripts to the file.

1 ACCEPTED SOLUTION

Accepted Solutions
Katz0801
Level II

Re: Deleting Duplicate Scripts

Update - I solved it using this method:

dt = Current Data Table(); 
names = dt << Get Table Script Names;

Show(names);
wordsToDelete = {"Script 1 name", "Script 2 name", "Script 3 name"};
For(i = 1, i <= N Items(names), i++,
    scriptName = names[i];
    containsWord = 0;
    For(j = 1, j <= N Items(wordsToDelete), j++,
        word = wordsToDelete[j];
        If( Contains( scriptName, word ),
            containsWord = 1;
            Break();
        );
    );
   If( containsWord,
        dt << Delete Scripts( scriptName );
    );
);
 

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Deleting Duplicate Scripts

You can use Get Table Script Names to get names of all table scripts. Then you can filter that down to a list of scripts you wish to remove and finally delete them with << Delete Scripts

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
names = dt << Get Table Script Names;
Show(names);
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << New Table Script(
	"New Script",
	Distribution(Column(:Height, :Weight), By(:sex))
);
Wait(2);
dt << Delete Scripts("New Script");
-Jarmo
Katz0801
Level II

Re: Deleting Duplicate Scripts

Update - I solved it using this method:

dt = Current Data Table(); 
names = dt << Get Table Script Names;

Show(names);
wordsToDelete = {"Script 1 name", "Script 2 name", "Script 3 name"};
For(i = 1, i <= N Items(names), i++,
    scriptName = names[i];
    containsWord = 0;
    For(j = 1, j <= N Items(wordsToDelete), j++,
        word = wordsToDelete[j];
        If( Contains( scriptName, word ),
            containsWord = 1;
            Break();
        );
    );
   If( containsWord,
        dt << Delete Scripts( scriptName );
    );
);
 

Recommended Articles