Hi All,
I'm having difficulty with variables that evaluate normally in one Expr1() not evaluating properly in another Expr2() that calls the first Expr. I have some code where I've defined an Expr1() that generates distributions of columns of interest. I have another expression later on, Expr2() that calls back to Expr1(). There are variables in Expr1() that appear not to evaluate properly in Expr2().
For a visual, Expr2() generates a window that looks like the following:
The first expression, Expr1() is what generates the included Distribution platform below the graph builder. The combo box and button boxes below the distributions allow the user to switch between different fit statistics, such as different R^2, RMSE, Mean Abs Dev, -Logliklihood, etc. My intent is to update both the GB and Distribution accordingly. The GB updates appropriately, but the Distribution does not. When changing the Fit Statistic to RMSE, for example, this is the outcome:
It does update the Distribution graphs, but it uses their default size setting and not the size setting I've established within Expr1(). it's supposed to look like this where the distribution graphs are the same size as in the first image:
The section of code in Expr1() where the Distributions are generated is the following:
//this part gets column names to insert into Dispatch() below
sfitcol1 = Column( NNYCol + NNcolshift ) << Get Name;
sfitcol2 = Column( NNYCol + 1 + NNcolshift ) << Get Name;
sfitcol3 = Column( NNYCol + 2 + NNcolshift ) << Get Name;
//in this example, the results are:
//"RMSE Training"
//"RMSE Validation"
//"RMSE Test"
//this part generates the Distributions that will be used to change my output report in Expr2()
dt_results << Distribution(
Continuous Distribution( Column( Eval( NNYCol + NNcolshift ) ), Quantiles( 0 ) ),
Continuous Distribution( Column( Eval( NNYCol + 1 + NNcolshift ) ), Quantiles( 0 ) ),
Continuous Distribution( Column( Eval( NNYCol + 2 + NNcolshift ) ), Quantiles( 0 ) ),
SendToReport(
Dispatch( {sfitcol1}, "Distrib Histogram", FrameBox, {Frame Size( 60, 100 )} ),
Dispatch( {sfitcol1}, "Distrib Outlier Box", FrameBox, {Frame Size( 30, 100 )} ),
Dispatch( {sfitcol2}, "Distrib Histogram", FrameBox, {Frame Size( 60, 100 )} ),
Dispatch( {sfitcol2}, "Distrib Outlier Box", FrameBox, {Frame Size( 30, 100 )} ),
Dispatch( {sfitcol3}, "Distrib Histogram", FrameBox, {Frame Size( 60, 100 )} ),
Dispatch( {sfitcol3}, "Distrib Outlier Box", FrameBox, {Frame Size( 30, 100 )} )
)
);
If I run the Expr1() on it's own, it works just fine, the problem is when Expr2() calls Expr1() that it fails because of how it's not evaluating the variables sfitcol# in Dispatch, so it's not changing the FrameBox size as it's supposed to in the code.
The section of code in Expr2() that swaps out the distributions (using the combo box only) is below:
NNycb = Combo Box(
NNylist,
<<Set( 1 ),
<<Set Function(
Function( {},
NNycol = NNycb << Get;
NNxcol = NNxcb << Get;
NNgb << delete;
NNd << delete;
NNrob << Sib Prepend( NNgb = NNgb_change );
NNlbcontent << Sib Prepend( NNd = NNdist_change );//this is where Expr2() calls Expr1(), NNdist_change
)
)
)
Playing around with putting the part of Expr1() in the Combo Box function and then trying to run the sfitcol variables and then sending to the report to modify the frame box gives this error in the embedded log:
Cannot find item "sfitcol1" in outline context {sfitcol1}
Cannot find item "sfitcol1" in outline context {sfitcol1}
Cannot find item "sfitcol2" in outline context {sfitcol2}
Cannot find item "sfitcol2" in outline context {sfitcol2}
Cannot find item "sfitcol3" in outline context {sfitcol3}
Cannot find item "sfitcol3" in outline context {sfitcol3}
If I then manually enter in the column name, for example with the first Dispatch: Send to Report(Dispatch({"RMSE Training"}, "Distrib Histogram", Framebox, Frame Size{(60,100)}), then it will change the frame box accordingly.
So, it's possible, and should work through how I've defined things in Expr1(), but the variable and not the value(text) of the variable is passed when executing things in Expr2(). Hoping to get some suggestions on how to correct this. I don't think I need to use an Eval(Substitute(Expr())) type solution, but perhaps I do.
Any thoughts/ideas/suggestions are much appreciated.
Thanks!,
DS