use of the values in a column to generate a string, in order to use the string as a parameter for stack
Aug 13, 2012 12:34 PM(1931 views)
my need is: stack a table with a dynamical (well, sort of) selection of the column to stack. I solved with a config table in which the names of the colums to be stacked are stored as values, then I do a "get values" and
assign the result to a string. finally I feed this string to stack command.
it works, but ... every time in my log it says
Errors found. in access or evaluation of 'columns' , Bad Argument( Eval( d ) )
, columns( Eval( d ) )" without eval it does not run, with eval it runs perfectly but pollute my log. does anyone knows why?
here is the code:
conf3 = open ("\here is the config table");
// load config, it is a excel file to be edited by the users in order to choose what "class" they want in the final report
// these class sets are quite stable, and most of the times are untouched from the last execution, but sometimes a class has to be added or changed // it is simply like this: column1: black white red column2: red white etc
d=Column(conf3,i)<<get values; // i is the index // I do it in a cycle, each run for a different table to be stacked reading a different column for a different stack set // here I do get values from the i-th column of the config, and assing it to the string d --> it is good?
snowhite = Open( "\jmp_tables\snowhite.jmp" , invisible ); // load the table to be stacked
I guess that d is not a string here, but a list of strings as <<get values yields a list (or matrix for continuous variables). If the class sets in conf3 differ in number of items the table will have as many rows as the biggest set. Then for some choises d will contain empty string items i.e "". That may be the cause of the reported error (columns must have a name other than "").
With the line of code below you can remove all instances of "" from d prior to stacking. It may be an easier way to tidy the lists, but this should work.