pmroz,
Many thanks for the input! Being a novice, I'm still getting use to JSL flow and functionality, and would be glad for expert guidance. I included the entire script (pared down), to show you the overall flow. Based on previous coding experience which considered a main macro and subroutines, I was trying to encapsulate routines in expressions so they could be called later in program ("Files()", "Join_files", and "Con").
I changed "Graphs = Eval Expr" to "Graphs = Expr", and everything works. I wasn't sure if this needed an Eval since it was called in another expression (Join_files).
I had used graphs in new window, but still get an empty window.
Many thanks again for your valuable time.
Neil
Files = Expr(
SD1 = "C:\Users\";
path = {};
f1 = Files In Directory( SD1, recursive(1));
For( i = 1, i <= N Items( f1 ), i++,
If(Ends With( f1[i], ".csv" ),
f1[i] = Convert File Path(SD1) || f1[i];
b= f1[i];
Insert Into(path, b)
);
);
);
Join_files = Expr(
For( i = 1, i <= N Items( path ), i+=2,
/*area, %area, and pore pixel count*/
jointable1 = Open( path[i] );
//jointable1 << Get Name;
samplename = Substr( jointable1 << Get Name, 1, 18 ); //sample replicate name //
samplename2 = Word(1,q, "_"); // only sample name, no replicate suffix
jointable1 << New Column( "Sample",
Character,
Nominal,
Set Each Value( samplename ) // setting each row in column 1 to samp rep name //
);
jointable2 = Open( path[i + 1] );
dt = Data Table( jointable1 ) << Join(
With( Data Table( jointable2 ) ),
Select( :Sample, :Area, :Name( "%Area" ),:scale,:thick),
SelectWith( :pixD1, :count1),
Cartesian Join
);
Close( jointable1, no save );
Close( jointable2, no save );
Columns();
Graphs();
Graphs2();
Graphs3();
dt << Set Name(samplename);
po = dt << get name;
dt << Save(SD1 || po);
);
nw = new window("Example Export Multiple Platforms",
chart_output = vlistbox(
graphs,
);
);
);
Columns = Eval Expr(
dt << New Column( "Sample 2",
Character,
"Nominal",
Set Each Value(samplename2),
Set Display Width( 150 ),
);
);
Graphs = Eval Expr(
/*set graphs*/
dt << New Table Property( "Cumulative Resistivity",
Graph Builder(
Size( 591, 496 ),
Show Control Panel( 0 ),
Grid Color( "Black" ),
Graph Spacing( 2 ),
Variables(
X( :Name( "Diameter (um)" ) ),
Y( :Name( "flow resistivity (Pa*s/m^2)") ),
Overlay( :Sample )
),
Elements( Position( 1, 1 ), Line( X, Y, Legend( 20 ) ) ),
SendToReport(
Dispatch(
{},
"Diameter (um)",
ScaleBox,
{Min( 0 ), Max( 80 ), Inc( 1 ), Minor Ticks( 1 ),
Label Row(
{Show Major Grid( 1 ), Show Minor Grid( 1 )}
)}
),
Dispatch(
{},
"flow resistivity (Pa*s/m^2)",
ScaleBox,
{Scale( "Log" ), Format( "Scientific", 12 ), Min( 100000 ),
Max( 10000000000000 ), Inc( 1 ), Minor Ticks( 1 ),
Label Row( {Show Major Grid( 1 ), Show Minor Grid( 1 )} )}
),
)
)
)
);
Con = Expr(
dt = {};
// Sort list ascending (sample replicates) //
For( i = 1, i <= N Table(), i++,
table = data table(i);
insert into(dt, table);
sort list into(dt)
);
// Concatenate each file (sample replicates) //
dt_all= Data Table( dt[1] ) << Concatenate(
Data Table( dt[2] ),
Data Table( dt[3] ),
Output Table( "Concatenated Table" )
);
// Rename file to sample name and Save //
dt_all << set name(samplename2);
dt_all:Sample << Set Display Width( 150 ); // Widen to include entire title
p = dt_all << get name;
dt_all << Save(SD1 || p);
close(dt_all, no save);
close(dt[1], no save);
close(dt[2], no save);
close(dt[3], no save);
);
Files();
Join_files();
Con();
Neil