JSL_open and join data tables from a list in a for loopHello, I am trying to write a script to join tables in JSL, where we can input the number of tables to join. For this, I created lists to input html table location, tables names and joiner columns.
Before the join, I start by opening the tables, taking an element from the lists in a for loop.
I get an error message "Subscript problem in access or evaluation of "tables_list[i]", tables_list[/*###*/].
Any idea what I did wrong? Thank you in advance for the support
// Indicate how many input data tables you have (default = 1)
nb_join_tables = 2;
// Indicate here the link to the first input HTML table
input_table_01 = "http://xxxx.html";
// Indicate here the names you want for your first JMP data tables
JMP_table_01_name = "xxx -01";
// Indicate here the link to the input HTML table to join
input_table_02 = "http://xxxx.html";
input_table_03 = "http://xxxx.html";
// Indicate here the names you want for the data tables to join
JMP_table_02_name = "xxx -02";
JMP_table_03_name = "xxx -03";<BR /><BR />// indicate here the column you want JMP to use as joiner for the tables merge (default:Parameter Set Name)<BR />joiner_table_01 = "Parameter Set Name";<BR />joiner_table_02 = "Parameter Set Name";<BR />joiner_table_03 = "Parameter Set Name";
// Create lists according to the number of tables to merge
tables_list = {input_table_01,input_table_02,input_table_03};
names_list= {JMP_table_01_name,JMP_table_02_name,JMP_table_03_name};
joiners_list = {joiner_table_01,joiner_table_02,joiner_table_03};
For( i = 0, i <= nb_join_tables, i++,
//Open html data table from specific location
dt=Open(
tables_list[i],
HTML Table( 4, Column Names( 0 ), Data Starts( 1 ) )
);
// Set JMP data table name to the desired one
dt << Set Name( names_list[i] );
);Automation and ScriptingData AccessQuality and Process EngineeringRe: JSL_open and join data tables from a list in a for loopGreat, thank you, that works!!
Re: JSL_open and join data tables from a list in a for loopthis code
tables_list = {input_table_01,input_table_02,input_table_03};makes a list of names of variables, not a list of the content of the variables. Open is seeing the name of the variable where it expects the content. You can use this to evaluate the names to their content:
tables_list = Eval List( {input_table_01,input_table_02,input_table_03} );or you can build the list like this:
tables_list = {};
tables_list[1] = input_table_01;
tables_list[2] = input_table_02;
tables_list[3] = input_table_03;Re: JSL_open and join data tables from a list in a for loopHere is the log :
i = 1;
tables_list = {input_table_01, input_table_02, input_table_03, input_table_04, input_table_05, input_table_06};
input_table_01
Open argument must be string in access or evaluation of 'Open' , Open/*###*/(tables_list[i], HTML Table( 4, Column Names( 0 ), Data Starts( 1 ) ))
Re: JSL_open and join data tables from a list in a for loopadd a debugging statement just before the place it fails:
For( i = 0, i <= nb_join_tables, i++,
show(i, tables_list); // check the log window for the output
//Open html data table from specific location
dt=Open(
tables_list[i],
HTML Table( 4, Column Names( 0 ), Data Starts( 1 ) )
);
// Set JMP data table name to the desired one
dt << Set Name( names_list[i] );
);
Re: JSL_open and join data tables from a list in a for loopHello Craige,
I tried also with n= 1 and it does not work neither. Actually, I've put i=1 to start with and tested to i=0 just in case and forgot to put i=1 again before posting.
Does not seem to be the issue though.
Any other idea?
Re: JSL_open and join data tables from a list in a for loopJSL lists and matrices start at 1. JMP uses for( i = 1, i <= n, i++, ... rather than for( i = 0, i < n, i++, .