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
- :
- How do I copy a row of selected data from one tabl...

Topic Options

- 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
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jul 12, 2017 9:14 AM
(1997 views)

Trying to use jsl script to copy a row of data that was selected from a fit y by x and paste that to another table (BigClass2). Using the Big Class table, Oneway Analysis of height By name, I select one point on the chart which selects the row in the table. I can get the row number but cannot find how to copy the selected cell values. Searched forum and did not locate a solution.

Any help would be appreciated.

dt = Data Table( "Big Class" );

dt2 = Data Table( "BigClass2" );

sel = dt << Get Selected Rows;

1 ACCEPTED SOLUTION

Accepted Solutions

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

Jul 12, 2017 12:02 PM
(3903 views)

Solution

Make the subset invisible, then delete it when no longer needed.

```
dt = Open( "$sample_data/Big Class.jmp" );
dt2 = subset( dt );
dt << select rows( {2, 4, 6} );
dt3 = dt << subset( Selected Rows( 1 ), Selected columns only( 0 ),invisible );
dt2 << concatenate( dt3, AppendToFirstTable( 1 ) );
close(dt3,"nosave");
```

Craige

5 REPLIES

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

Jul 12, 2017 10:22 AM
(1990 views)

Here's one approach using data table subscripting (needs JMP 13); it depends on the table columns being identically ordered.

dt = Open( "$sample_data/Big Class.jmp" );

dt2 = subset( dt );

dt << select rows( {2, 4, 6} );

sel = dt << Get Selected Rows; // [2,4,6]

seldata = dt[sel, 0]; // {{"LOUISE", 12, "F", 61, 123}, {"J...

oldend = N Rows( dt2 ); // 40

dt2 << addrows( N Items( seldata ) ); // add 3 rows to end

// copy the seldata to the end, one after the old end

dt2[oldend + 1 :: oldend + N Items( seldata ), 0] = seldata;

Here's an approach using concatenation:

```
dt = Open( "$sample_data/Big Class.jmp" );
dt2 = subset( dt );
dt << select rows( {2, 4, 6} );
dt3 = dt << subset( Selected Rows( 1 ), Selected columns only( 0 ) );
dt2 << concatenate( dt3, AppendToFirstTable( 1 ) );
```

Craige

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

Jul 12, 2017 11:33 AM
(1981 views)

Hi Craige,

Thank you for the quick reply.

The columns are identically ordered. Using JMP 11 so the data table subscripting does not seem to work. See screenshot below.

The concatenation script opens a subset table which I do not require. I have 2 tables open, one table generates a chart. From this chart I select specific points that are to be copied to another table. I will be selecting a single data point and then run the script to copy the data over the the table. Then select another point and run the script.

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

Jul 12, 2017 11:42 AM
(1980 views)

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

Jul 12, 2017 12:02 PM
(3904 views)

Make the subset invisible, then delete it when no longer needed.

```
dt = Open( "$sample_data/Big Class.jmp" );
dt2 = subset( dt );
dt << select rows( {2, 4, 6} );
dt3 = dt << subset( Selected Rows( 1 ), Selected columns only( 0 ),invisible );
dt2 << concatenate( dt3, AppendToFirstTable( 1 ) );
close(dt3,"nosave");
```

Craige

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

Jul 13, 2017 7:13 AM
(1927 views)