- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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 );
);
);
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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 );
);
);