Create prediction expression display based on column formulaI would like to create a formatted prediction expression, based on a column formula, in a custom report window. When I fit a linear model using Fit Least Squares, in the model report, I can turn on the display of the prediction expression, which displays a formatted "picture" view of the equation.
I can then save the equation to the data table as a column with a formula.
Now I want to select that column and display a prediction expression for the formula saved to the column, all by itself, in a new report window.
Is there a way to do this with JSL?
Mass CustomizationRe: Create prediction expression display based on column formulaYou can simply retrieve the formula with a <
Names Default To Here( 1 );
dt = New Table( "Example",
add rows( 10 ),
New Column( "The Column", formula( Random Integer( 1, 100 ) ) )
);
theFormla = dt:The Column << get formula;
Re: Create prediction expression display based on column formulaThanks, that's what I needed. I knew there was a way to do it, I just couldn't remember the Expr as Picture() box display object.
Re: Create prediction expression display based on column formulaIt has been a while since I posted this a got a good answer. I wanted to share the script I developed to allow for quickly viewing the formulas in columns in a data table, allowing to switch columns interactively.
/* this script presents a list of columns in the current data table
in a list box, and upon selecting a column, if the column has a formula,
it will display the formula below the list box as a picture.
If the column does not have a formula, "No Column Formula" is displayed
*/
Names Default To Here( 1 );
_dt = Current Data Table();
expr_ShowFormulaAsPicture = Expr(
_vb1 << Delete;
_vb << Append( _vb1 = V List Box() );
_c = Column( dt, (_clb << Get Selected)[1] );
If( Is Empty( _c << Get Property( "Formula" ) ),
_vb1 << Append( Text Box( "No Column Formula" ) ),
_vb1 << Append( Picture Box( Expr As Picture( _c << get formula ) ) )
);
);
New Window( "Show Column Formula as Picture",
_vb = V List Box(
)
);
_vb << Append(
_pb = Panel Box( "Select Column With Formula To Display as Picture",
_clb = Col List Box(
_dt,
max selected( 1 ),
grouped,
all,
On Change( expr_ShowFormulaAsPicture )
)
)
);
_vb << Append( _vb1 = V List Box() );
Example window here:
