Concatenation of multiple tablesI have found a method in the forum that provided the capability of concatenating tables together. I have tried with a list of existing tables where the starting tables is of the same kind. Does somebody detect my fault?
Names Default To Here( 1 ); Clear Log(); Clear Symbols(); Close All(Data Tables, No Save); Close All(Journals, No Save); Close All(Reports,No Save);
Path = "C:\Users\u387536\Documents\01 Data and Analysis\08 IP21 to JMP Data Integraton\Working Folder Data Read-In\Data\";
filelist = {};
filelist[1] = Open(Path||"file 1.jmp",private);
filelist[2] = Open(Path||"file 2.jmp",private);
filelist[3] = Open(Path||"file 3.jmp",private);
filefinal = "file 123.jmp";
nf=nitems(filelist); //number of items in the working list
cctable= New Table( "Combined data table ");//make an empty table
cctable << New Column( "Source", Character, Nominal );
For( iii = 2 , iii <= nf, iii++, //this starts the first loop
filenow = ( filelist[iii] );
fileopen=(filepath||filenow);
//dt=open(fileopen,private);
//dt=open(fileopen,importset,private);//Import settings used in the open argument
dt = filelist[1];
New Column( "Source", Character, Nominal );
:Source << set each value( filenow );
//dt<<NEW column=""></NEW>
Re: Concatenation of multiple tablesCheck and see the value of "filenow". I assume you believe that it has just the value of the data table. But what you will see is that it's value is:
Data Table("the file name")
If what you want is just "the file name", you need to request it to be returned from "filenow"
filenow << get name
I strongly recomment you read the Scripting Guide
Help==>Books==>Scripting Guide
It will show how you can view what a variables value is by placing your cursor on the variable, or by using the show() function to see it, or to use the JSL debugger so you can step through the code and see exactly what the code is doing.
Re: Concatenation of multiple tablesThe error that pops up in the log is:
Wrong result type for expression for column Source{1} in access or evaluation of 'set each value' , set each value( filenow ) /*###*/
Re: Concatenation of multiple tablesWhat error do you see in teh log, please ('Windows > Log')? Looks like 'filepath' is not assigned.