- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Concatenate output tables from a Loop
Hello JMP community!
I had these 5 tables coming from a loop. Below is the screenshot of the script (Assuming its working fine)
How should I write a script that concatenates all the output table of the loop?!
Appreciate all inputs from this community!
Thanks in advance!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Concatenate output tables from a Loop
Hi @switzal87,
The following will concatenate the last 5 tables opened:
Data Table(N Table()) << Concatenate(
Data Table( N Table()-1 ),
Data Table( N Table()-2 ),
Data Table( N Table()-3 ),
Data Table( N Table()-4 ),
Create source column
);
This works because Data Table(number) refers to a specific table, N Table() returns the number of data tables open in JMP, data tables are numbered based on when they are opened, thus Data Table(N Table()) returns the last table, and subtracting k from N Table() returns the table opened k tables ago. You could generalize this by writing a loop to generate the concatenation code, but if you're always pulling 5 tables this is a pretty easy way to combine them.
I hope this helps!
edit: Here is a generalized version for any number of tables:
tableList={};
for(k=1,k<=4,k++,InsertInto(tableList,Data Table( N Table()-k )));
Data Table(N Table()) << Concatenate(tableList,Create source column);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Concatenate output tables from a Loop
Hi @switzal87,
The following will concatenate the last 5 tables opened:
Data Table(N Table()) << Concatenate(
Data Table( N Table()-1 ),
Data Table( N Table()-2 ),
Data Table( N Table()-3 ),
Data Table( N Table()-4 ),
Create source column
);
This works because Data Table(number) refers to a specific table, N Table() returns the number of data tables open in JMP, data tables are numbered based on when they are opened, thus Data Table(N Table()) returns the last table, and subtracting k from N Table() returns the table opened k tables ago. You could generalize this by writing a loop to generate the concatenation code, but if you're always pulling 5 tables this is a pretty easy way to combine them.
I hope this helps!
edit: Here is a generalized version for any number of tables:
tableList={};
for(k=1,k<=4,k++,InsertInto(tableList,Data Table( N Table()-k )));
Data Table(N Table()) << Concatenate(tableList,Create source column);