A couple of issues.
1. Your Graph Builder code had a missplaced ")" which was ending the code with a parsing error.
2. The :Name() function does not resolve elements, so you can not have something like: cols[f] as a value for the function. It needs to be passed just a quoted string,
The code below fixes both issues
For( f = 1, f <= N Items( plots ), f++,
Eval(
Substitute(
Expr(
__plots__ = Graph Builder(
Size( 1267, 905 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables( X( :RPN, Order By( __col__ ), Descending, Order Statistic( "Mean" ) ) ),
Y( __col__ ),
Elements( Bar( X, Y, Legend( 4 ), Label( "Label by Value" ) ) ),
SendToReport(
Dispatch( {}, "Graph Builder", OutlineBox, {Set Title( outline titles[f] )} ),
Dispatch( {}, "RPN", ScaleBox, {Max( 10.5 ), Label Row( Label Orientation( "Angled" ) )} ),
Dispatch( {}, "400", ScaleBox, {Legend Model( 4, Properties( 0, {Fill Color( 53 )} ) )} ),
Dispatch( {}, "graph title", TextEditBox, {Set Text( plot titles[f] )} ),
Dispatch( {}, "X title", TextEditBox, {Set Text( "RPN" )} ),
Dispatch( {}, "Y title", TextEditBox, {Set Text( "Affected Lots" )} ),
Dispatch( {}, "400", LegendBox, {Set Title( "" )} )
)
)
),
Expr( __plots__ ), Parse( "Plots" || Char( f ) ),
Expr( __col__ ), Parse( ":Name(\!"" || Char( cols[f] ) || "\!")" )
)
)
);
Jim