I had to guess at a few things, but the script below creates a separate pdf for each of the files found in the datatable folders. I modified the graph format a bit. It shows all of the same information, as I can best determine, but in a slightly different form.
In the script, you will need to put in the paths to folder 1 and folder 2. Currently, the pdf's are being save in the $TEMP directory. You will need to change them to a real folder.
Names Default To Here( 1 );
// Set folder1 and folder2 paths
folder1 = "path to folder 1";
folder2 = "path to folder 2";
// Get files in datafolder 1 folder
fileNamesList = Files In Directory( folder1 );
For( File = 1, File <= N Items( fileNamesList ), File++,
// Open the file in datafolder1
dt1 = Open(
folder1 || "/" || fileNamesList[File],
Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( Tab, Comma, CSV( 1 ) ),
Strip Quotes( 1 ),
Use Apostrophe as Quotation Mark( 0 ),
Use Regional Settings( 0 ),
Scan Whole File( 1 ),
Treat empty columns as numeric( 0 ),
CompressNumericColumns( 0 ),
CompressCharacterColumns( 0 ),
CompressAllowListCheck( 0 ),
Labels( 1 ),
Column Names Start( 1 ),
Data Starts( 2 ),
Lines To Read( "All" ),
Year Rule( "20xx" )
)
);
// New column: Index
dt1 << New Column( "Index", Numeric, "ordinal", Format( "Best", 12 ), Set Each Value( Row() ) );
// New column: Index
dt1 << New Column( "Measured", Character, Set Each Value( "Before" ) );
// Open the file in datafolder2
dt2 = Open(
folder1 || "/" || fileNamesList[File],
Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( Tab, Comma, CSV( 1 ) ),
Strip Quotes( 1 ),
Use Apostrophe as Quotation Mark( 0 ),
Use Regional Settings( 0 ),
Scan Whole File( 1 ),
Treat empty columns as numeric( 0 ),
CompressNumericColumns( 0 ),
CompressCharacterColumns( 0 ),
CompressAllowListCheck( 0 ),
Labels( 1 ),
Column Names Start( 1 ),
Data Starts( 2 ),
Lines To Read( "All" ),
Year Rule( "20xx" )
)
);
// New column: Index
dt2 << New Column( "Index", Numeric, "Ordinal", Format( "Best", 12 ), Set Each Value( Row() ) );
// New column: Index
dt2 << New Column( "Measured", Character, Set Each Value( "After" ) );
// Concatenate tables
// → Data Table( "HW.DiodeTest.ADP_diodes" )
dt1 << Concatenate( dt2, Append to first table );
// Close the After data table
Close( dt2, nosave );
// get all continuous columns in the data table
colNamesList = dt1 << get column names( continuous, string );
theJournal = New Window( fileNamesList[File], <<journal );
theJournal << show window(0);
// Loop through all of the columns
For( graph = 1, graph <= N Items( colNamesList ), graph++,
gb = Graph Builder(
Size( 531, 308 ),
Show Control Panel( 0 ),
Variables( X( :Index ), Y( As Column( colNamesList[graph] ) ), Overlay( :Measured ) ),
Elements( Line( X, Y, Legend( 14 ) ) ),
SendToReport(
Dispatch(
{},
"Index",
ScaleBox,
{Min( -0.5 ), Max( 47.513842007589 ), Inc( 10 ), Minor Ticks( 0 )}
),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
14,
Properties( 0, {Line Width( 4 )}, Item ID( "After", 1 ) ),
Properties( 1, {Line Width( 4 )}, Item ID( "Before", 1 ) )
)}
),
Dispatch( {}, "graph title", TextEditBox, {Set Text( "" )} ),
Dispatch( {}, "400", LegendBox, {Sides( "Top" )} )
)
);
Report( gb )[Outline Box( 1 )] << set title( colNamesList[graph] );
theJournal << append( Report( gb ) );
gb << close window;
);
// Save the journal
theJournal << save pdf( "$TEMP/" || fileNamesList[File] || ".pdf", portrait( 1 ) );
// Close the journal
theJournal << close window;
// clean up the workspace by closing the current data table
Close( dt1, nosave );
);
open("$TEMP/" ||fileNamesList[2]||".pdf")
Jim