Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Deleting rows using JSL scripts

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Dec 6, 2010 2:02 PM
(16468 views)

How can we delete rows from a data table (using JMP script) when some columns in this data table satisfy a particular criteria?

Using Delete Rows is not working for me in my script.

Thanks

Using Delete Rows is not working for me in my script.

Thanks

2 ACCEPTED SOLUTIONS

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Here is one way to do it.

```
dt = Current Data Table();
For Each Row( Row State() = Selected State( criteriacolumn[] == criteria ) );
dt << delete rows();
```

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Here's another way. I don't know if it's any faster.

```
dt << select where(:N < min_case_value);
dt << delete rows;
```

5 REPLIES 5

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Here is one way to do it.

```
dt = Current Data Table();
For Each Row( Row State() = Selected State( criteriacolumn[] == criteria ) );
dt << delete rows();
```

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Deleting rows using JSL scripts

Thanks MS, it works.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Here's another way. I don't know if it's any faster.

```
dt << select where(:N < min_case_value);
dt << delete rows;
```

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Deleting rows using JSL scripts

> Here's another way. I don't know if it's any

> faster.

Well I made a table with 6 columns and 100,000 rows and the For solution took about 1 second and the direct select took "0" seconds.

When I increased the number of rows to 1,000,000 then the For solution took 11 or 12 seconds and the direct select took 3 seconds.

So on my pc running winXP using this particular table the direct select is about 4 times faster but you would need a really large table to notice the difference.

Michael

> faster.

Well I made a table with 6 columns and 100,000 rows and the For solution took about 1 second and the direct select took "0" seconds.

When I increased the number of rows to 1,000,000 then the For solution took 11 or 12 seconds and the direct select took 3 seconds.

So on my pc running winXP using this particular table the direct select is about 4 times faster but you would need a really large table to notice the difference.

Michael

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Deleting rows using JSL scripts

Thanks!

Fast is good. The direct method has also the advantage that easier to read (and remember).

The loop method still is useful when you need to set other or combined row states.

Fast is good. The direct method has also the advantage that easier to read (and remember).

The loop method still is useful when you need to set other or combined row states.