I took a shortcut in solving the issue. I added a JMP list called "titles" that is populated after each is run and immediately after the Outline Box() title is set. I then just use the titles list in the Table Box() in your dlg section.

Names Default To Here( 1 ); // will ignore normal JSL naming
sd = currentdatatable(); // call upon open data table
// Define that Fitmod is empty. We will fill this with our information in the loop
Fitmod = {};
// Determine the levels in the ID column
summarize( sd, ByGroups = By( :Batch ) );
// Determine the result columns
colList = sd << Get Column Names( Continuous, String );
sum = 0; // Prepare getting the total number of result columns. Will be updated in the loop
titles = {};
// Loop across each level of Batch
nw_means = New Window("My Report",
For( i = 1, i <= Nitems( colList ), i++,
For Each( {BG, group}, ByGroups,
Fm = Fit Model(
Y( colList[i] ),
Effects( :Laboratory ),
Random Effects( :Day[:Laboratory] ),
NoBounds( 0 ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Emphasis( "Effect Leverage" ),
Run(
colList[i] << {Summary of Fit( 1 ), Analysis of Variance( 0 ),
Parameter Estimates( 1 ), Scaled Estimates( 0 ), Plot Actual by Predicted( 1 ),
Plot Regression( 0 ), Plot Residual by Predicted( 1 ),
Plot Studentized Residuals( 0 ), Plot Effect Leverage( 1 ),
Plot Residual by Normal Quantiles( 0 ), {:Person << {LSMeans Student's t( 0.05 )}}}
),
Where( :Batch == ByGroups[group] ),
SendToReport(
Dispatch( {"" }, "Whole Model", OutlineBox, {Close( 1 )} ),
Dispatch(
{"", "Laboratory"},
"Leverage Plot",
OutlineBox,
{Close( 1 )}
)
)
);
report(fm)[OutlineBox(1)] << set title(report(fm)[OutlineBox(1)] << get title || ", ID=" || BG);
// Save the pointer to the results in the Fitmod list
Insert Into( Fitmod, Fm );
insert into(titles, report(fm)[OutlineBox(1)] << get title);
);
sum = sum + 1
);
);
// Set the lists for the storage of the data from the by groups
testValue = dif = sumfit1 = sumfit2 = {};
// Loop across each by group and gather the data
For Each( {rpt, group}, Fitmod,
// Point to the current report
reportFitmod = Fitmod[group] << Report;
// Get the means for the 2 levels
sumfit = reportFitmod[Outline Box( "Least Squares Means Table" )][Number Col Box( 1 )] << Get as Matrix;
Insert Into( sumfit1, sumfit[1] );
Insert Into( sumfit2, sumfit[2] );
term = reportFitmod[Outline Box( "Least Squares Means Table" )][String Col Box( 1 )] << Get();
// Get By Group column
whereCol = Word( 2, ((reportFitmod << parent)[Text Box( 1 )]) << get text, ":=)" );
// Get data from CrossTab table
crossTab = reportFitmod[Outline Box( "LSMeans Differences Student's t" )][CrosstabBox( 1 )] << get as matrix;
meandiff = Round( crossTab[1, 2] , 4 );
lowerCL = Round( crossTab[3, 2] , 3 );
upperCL = Round( crossTab[4, 2] , 3 );
// Get the Response variable name
Insert Into( testValue, (Substr( (reportFitmod << topparent)[Outline Box( 1 )] << get title, 10 )) );
// Create the Difference in mean and CL string
Insert Into( dif, Char( meandiff ) || " [" || Char( lowerCL ) || " ; " || Char( upperCL ) || "]" );
);
// Create the table
dlg = New Window( "Custom Report",
Outline Box( "Selected Values",
Lineup Box( N Col( 2 ), Text Box( "Factor of Interest: " ), Text Box( term[1] ) ),
Spacer Box( size( 0, 10 ) ),
tb = Table Box(
String Col Box( "Paramenter", titles ),
String Col Box( whereCol, repeat(ByGroups, sum) ),
Number Col Box( "Mean, " || term[1], sumfit1 ),
Number Col Box( "Mean, " || term[2], sumfit2 ),
String Col Box( "Difference in mean and CI", dif )
)
)
);
tb << Set Shade Headings( 0 ); // Turn off shaded table headings.
tb << Set Column Borders( 1 ); // Turn off table column borders.
tb << Set row Borders( 1 );
tb << border( 1 );
Jim