Add rows every x rowsDear community, i've got a huge table and would like to add one row every 4 rows (4 rows data, adding 1 row, moving the rest of the data downwards, then adding 1 row after 4 rows of data aso).
I have no clue how to achieve that with a script. Can anyone kindly help me with this topic?
Advanced Statistical ModelingAutomation and ScriptingData AccessMass CustomizationRe: Add rows every x rowsThat did the trick. Thanx.
Re: Add rows every x rowsI bet you are using JMP 13 or earlier. The "After" capability was added in JMP 14. Here is alternative way to do what you need
names default to here(1);
dt=open("$SAMPLE_DATA/big class.jmp");
dt4 = New Table("Results");
For(i=1,i<=n rows(dt), i=i+3,
dt<<SELECT where="">=i & Row()<=i+3);
dtTemp = dt << subset(selected rows(1), selected cols(0));
dt4 << concatenate(dtTemp, append to first table);
dt4 << add rows(1);
close( dtTemp, nosave );
);</SELECT>
Re: Add rows every x rowsI am running JMP13 but I don't think that is the cause of the issue. Think I will contact tech support.
Re: Add rows every x rowsIt works for me:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
For( i = N Rows( dt ), i >= 1, i = i - 4,
dt << Add Rows( 1, After( i ) )
);
Re: Add rows every x rowsWhen I run the code, I get the following error:
Name Unresolved: after in access or evaluation of 'after' , after( i ) /*###*/argument is wrong type in access or evaluation of 'after' , after( i ) /*###*/
In the following script, error marked by /*###*/
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
For( i = N Rows( dt ), i >= 1, i = i - 4,
dt << add rows( 1, after( i ) /*###*/ )
);
Re: Add rows every x rowsJust to add to @Mark_Bailey suggestion, here is a real simple example
names default to here(1);
dt=open("$SAMPLE_DATA/big class.jmp");
For(i=N Rows(dt),i>=1,i=i-4,
dt << add rows(1, after(i))
);Re: Add rows every x rowsSee Help > Scripting Index:

The << Add Rows message to the data table will do what you want. The optional After argument identifies the location, so you can space the insertions every 4 rows.
Use the For() function to iterate over the data table. The iteration will be easiest if you start at the end and insert on the way to the top. The insertions will each length the data table and complicate the counting if you start at the top.