- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Add Rows question
Hello,
New JSL scripter here. Trying to get 5 new rows added after every existing row, 25 rows in the data table. No issues while debugging, i changes from 25 to 1 in increments of 1 as expected, but no new rows are added to my data table at any point during/after the For loop. Not sure what I'm doing wrong, any help would be appreciated!
dt=current data table();
For(i=N Rows(dt),i>=1, i--,
dt << Add Rows( 5, i );
);
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Add Rows question
I've never used the 2-argument form, but the scripting index shows this example, using a keyword to specify the meaning of the 2nd arg
dt << Add Rows( 3, after( 5 ) );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Add Rows question
I am a bit confused. Given the below table
Your script creates
Which is what my understanding is what you want.
Here is my script, using your code that creates the above data table and it's expansion
Names Default To Here( 1 );
// Create a table with 25 rows
dt = New Table( "Example",
Add Rows( 25 ),
New Script( "Source", Data Table( "Untitled 97" ) << Subset( All rows, Selected columns only( 0 ) ) ),
New Column( "Column 1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
)
)
);
Wait( 5 );
// Now create the new rows
For( i = N Rows( dt ), i >= 1, i--,
dt << Add Rows( 5, i )
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Add Rows question
I've never used the 2-argument form, but the scripting index shows this example, using a keyword to specify the meaning of the 2nd arg
dt << Add Rows( 3, after( 5 ) );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Add Rows question
I am a bit confused. Given the below table
Your script creates
Which is what my understanding is what you want.
Here is my script, using your code that creates the above data table and it's expansion
Names Default To Here( 1 );
// Create a table with 25 rows
dt = New Table( "Example",
Add Rows( 25 ),
New Script( "Source", Data Table( "Untitled 97" ) << Subset( All rows, Selected columns only( 0 ) ) ),
New Column( "Column 1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
)
)
);
Wait( 5 );
// Now create the new rows
For( i = N Rows( dt ), i >= 1, i--,
dt << Add Rows( 5, i )
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Add Rows question
I think this was a simple case of "close it and open it again". My data table must have gotten corrupted somehow because when I closed and reopened it, my code worked fine. Sorry for any inconvenience.