Hello, I am a JSL beginner. I need to learn how to move a block of cells in one column to a different location in a different, newly created column. In this case, on top of this new column.
Specifically, I need to select a set of cells in column THK marked as PRE in a separate PRE/POST column, and paste them on top of a new column marked THK PRE. It is somewhat similar to the Split Column function, but I do not want to use the Split Column function as I find that, due to some glitch, the data sometimes appears scrambled in the newly created column if the data in some cells of the THK column is missing.
From some examples on the forums, I put together the code below, but it does not paste any values in the newly created THK PRE column. Please help! Many thanks in advance.
Here's what I need:
Starting data table
THK I PRE/POST
9.5 POST
9.8 POST
10.1 POST
11.0 PRE
11.4 PRE
10.9 PRE
Here's what I need the data table to look like after this operation:
THK | PRE/POST | THK PRE
9.5 POST 11.0
9.8 POST 11.4
10.1 POST 10.9
11.0 PRE
11.4 PRE
10.9 PRE
The script below does not paste any values in the newly created column, the column remains empty
// Pick the source data table
dt=Open("Data Table");
//Create New THK PRE column
dt << New Column( "THK PRE", Numeric, "Continuous");
Wait(1);
// Select PRE values from THK column
vals = Column(dt, "THK") << Get Rows Where(:Name("PRE/POST") == "PRE");
// Put these in the new column THK PRE
Column(dt, "THK PRE") << Set Values(vals)
Please help! Many thanks in advance. I use JUMP 16.0.0
@jthi