cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
shasheminassab
Level IV

How to delete X number of rows from end of each table before concatenating them?

I have a large number of CSV files (with same columns but different number of rows) in a folder and would like to concatenate them all. However, I need to delete 5 rows from end of each table before concatenating them. I would appreciate any help with writing the appropriate JSL code to do this job.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to delete X number of rows from end of each table before concatenating them?

Here is a simple script that will concatenate all open data tables after deleting the last 5 rows in each table.

Names Default To Here( 1 );

tableList = {};

For( i = 1, i <= N Table(), i++,
	Data Table( i ) << delete rows(
		Index( N Rows( Data Table( i ) ) - 4, N Rows( Data Table( i ) ) )
	);
	Insert Into( tableList, Data Table( i ) << get name );
);

dt = New Table( "All Tables" );

For( i = 1, i <= N Items( tableList ), i++,
	dt << concatenate( Data Table( tableList[i] ), append to first table( 1 ) )
);
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: How to delete X number of rows from end of each table before concatenating them?

Here is a simple script that will concatenate all open data tables after deleting the last 5 rows in each table.

Names Default To Here( 1 );

tableList = {};

For( i = 1, i <= N Table(), i++,
	Data Table( i ) << delete rows(
		Index( N Rows( Data Table( i ) ) - 4, N Rows( Data Table( i ) ) )
	);
	Insert Into( tableList, Data Table( i ) << get name );
);

dt = New Table( "All Tables" );

For( i = 1, i <= N Items( tableList ), i++,
	dt << concatenate( Data Table( tableList[i] ), append to first table( 1 ) )
);
Jim
shasheminassab
Level IV

Re: How to delete X number of rows from end of each table before concatenating them?

Thanks a lot Jim!!!

Recommended Articles