- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
JSL to select cells to copy to another table
hi everyone, sorry to jmp in on this conversation. I am new to JSl scripting.
I have table with thousands of rows. I need to be able to select a group of cells in one column, so I could copy it into another table. for example for Column: "Test3 (VOLTS)" only 1000 rows; I need to copy cells from row 50 thru row 200 using JSL code.
Thanks SAM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can I identify a report in jsl if that report is not associated with a variable?
Please find one way to do this:
NamesDefaultToHere(1);
// Get some data
dt = Open("$SAMPLE_DATA/Big Class.jmp");
// Suppose we want the values in rows 10 to 32 in the column containing 'weight'
vals = Column(dt, "weight")[10::32];
// Put these in a new table
dt2 = NewTable("Result", NewColumn("weight", Numeric, Continuous, Values(vals)));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can I identify a report in jsl if that report is not associated with a variable?
Please find one way to do this:
NamesDefaultToHere(1);
// Get some data
dt = Open("$SAMPLE_DATA/Big Class.jmp");
// Suppose we want the values in rows 10 to 32 in the column containing 'weight'
vals = Column(dt, "weight")[10::32];
// Put these in a new table
dt2 = NewTable("Result", NewColumn("weight", Numeric, Continuous, Values(vals)));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can I identify a report in jsl if that report is not associated with a variable?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can I identify a report in jsl if that report is not associated with a variable?
You could use the Subset() function to "copy" cells to a new table. It's very versatile and allows for conditional row selection.
A column can also be copied by getting and evaluating its script. See the JSL examples of both approaches below.
dt1 = Open("$sample_data\big class.jmp");
dt2 = New Table("another table", New Column("data", values(1 :: 10)));
// Copy column "height" to another table (here from dt1 to dt2)
Eval(Eval Expr(dt2 << Expr(dt1:height << get script)));
//Or more direct: use Subset()
// "Copy" entire column(s)
dt_new = dt1 << Subset(Columns(height), All rows(1));
// Or copy conditionally
dt2_new = dt1 << Subset(Columns(height), Rows(dt1 << get rows where(height > 62)));
a
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JSL to select cells to copy to another table
SamH,
I am looking to see if there is an issue with the Discussion Forum. Yesterday, you entered in a discussion question "Select a group of cells in a column" which is virtually identical to this discussion. Did yesterday's item not get displayed in the forum? Did you forget that you had already entered in the discussion item?(I certainly have done that myself)
As I said, I just want to make sure there isn't a problem, where your item from yesterday didn't get processed properly.