cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Ressel
Level VI

Error message when closing home made application via button ("Unresolved Column at row 1")

How can I make this error message here go away?

Ressel_1-1669320921221.png

It appears when I close table and window via the "Close Window" button after I have first drawn a graph. I copied in the script below, but to run it one would have to have open an adequate data table (see attached example). This, and only this table, should be open when running the script. This script is an attempt at having a little desktop stability calculator (very dirty, reasonably quick) / helper when writing reports, assessing product shelf-life etc.. It lets the user apply our normalized stability data (where t=0 corresponds with 100%rel.) to hypothetical starting concentrations of any quality parameter (as far as it is numeric) and quickly switch between settings and parameters. I made it thus far, but this error message is driving me nuts. (Also, can I show this on the next In-Person Nordics User Group: 05 October 2022 ?)

 

Ressel_0-1669320890610.png

 

Delete Symbols();
Names Default To Here( 1 );

dt = Current Data Table();
dt << Clear Row States;
dt << Clear Select;		// avoids accidentally including columns in colList

// alpha level for bivariate plot
alpha = 0.1;

// get lists for model selection
Batch = Associative Array( dt:Batch ) << Get Keys; // direct column reference

For( i = 1, i <= N Row( dt ), i++, // find all rel% columns
	For( j = 1, j <= N Col( dt ), j++,
		If( Column( j )[i] == 0,
			For( k = 1, k <= N Col( dt ), k++,
				If( Column( k )[i] == 100,
					Column( k ) << Set Selected( 1 )
				)
			)
		)
	)
);
colList = dt << Get Selected Columns;

// length of column list box
nItems = N Items( colList );

// radio box argument
rb1_expr = Expr( 					
	dt << Clear Row States;
	one_rb = rb1 << Get Selected;
	dt << Select Where( (dt:Batch == one_rb) ); // direct column reference
	dt << Invert Row Selection;
	dt << Hide and Exclude;
	dt << Invert Row Selection );
	
// "draw graph" button & column list selection arguments
action_expr = Expr( 
	vlb << Delete; // delete existing vlb
	
	yColAbs = Eval(
		Eval Expr(
			dt << New Column( one_rb || " / " || " / " || "start level = " || Char( startLevel ) || " for " || Char( yColRel ),
			formula( Expr(startLevel) / Expr(100) * (As Column( Expr( yColRel ) ) ) )
			)
		)
	);
	
	pb << Append( // append new vlb with fresh graph
		vlb = V List Box(
			biv = Bivariate(
				Y( yColAbs ), // is this the culprit?
				X( dt:Time ), // direct column reference
				Fit Line(
					{Confid Curves Fit( 1 ),
					Confid Curves Indiv( 1 ),
					Confid Shaded Fit( 1 ),
					Confid Shaded Indiv( 1 ),
					Line Color( {230, 159, 0} )},
					{Set α Level( 0.1 )}
				),
				Automatic Recalc( 1 ),
				SendToReport(
					// note reference to one_rb below in use for changing y axis label
					Dispatch( {}, one_rb, TextEditBox, {Set Text( "QC parameter value" )} ),
					Dispatch( {}, "timepoint 1", TextEditBox, {Set Text( "Time [months]" )} ),
					Dispatch( {}, "Linear Fit", OutlineBox, {Close( 1 )} )
				),
			)
		)
	)
);


// model selection window with radio buttons & colum list box
nw = New Window( "Model selection",
	Show Menu( 0 ),
	Show Toolbars( 1 ), // to have access to cross hair
	Border Box( Top( 0 ), Bottom( 20 ), Left( 20 ), Right( 10 ),
		H List Box(
			
			Panel Box( "Batch",
				rb1 = Radio Box(
					Eval List( Batch ),
					rb1_expr
				), 
			),
			
			Panel Box( "QC parameter (y-axis)",
				stabDat = Col List Box(
					Max Selected( 1 ),
					Width( 250 ),
					N Lines( nItems ),
					On Change(
						yColRel = Column( dt, (stabDat << Get Selected) );
						If(	Is Empty( startLevel ),
							//then
							Empty(),
							//else
							action_expr
						)
					)
				)
			),
			stabDat << Append( colList );
			
			Panel Box( "Action", 
				V List Box(
					H List Box (
						neb = Number Edit Box( Empty(), 7, << Set Function(
							startLevel = neb << Get;
							If(	Is Empty( yColRel ),
							//then
							Empty(),
							//else
							action_expr
						) ) ),
						Spacer Box( Size( 5, 0 ) ),
						Text Box( "Enter start level" )
					),
					
					Spacer Box( Size( 0, 10 ) ),
										
					Button Box( "Draw graph",
						If( ( Is Empty( startLevel ) + Is Empty( yColRel )) > 0,
							// then 
							New Window( "Message", modal,
								V List Box(
									Text Box( "QC parameter selection and/or start level missing!" ),
									Spacer Box( size( 0, 10 ) )
								)
							),
							// else
							action_expr
						)
					),
					
					Spacer Box( Size( 0, 10 ) ),
					
					Button Box ( "Close Window",
						If( !Is Empty( PF ), PF << Close Window);
						nw << Close Window;
						Close(dt, no save)					
					)
				)
			),

			pb = Panel Box( "Model",
				vlb = V List Box () // space for model graph
			) 
		)
	)
);

// making the initially selected buttons active in row selection 
one_rb = rb1 << Get Selected;
dt << Select Where( (dt:Batch == one_rb) );
dt << Invert Row Selection;
dt << Hide and Exclude;

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
jthi
Super User

Re: Error message when closing home made application via button ("Unresolved Column at row 1")

I think you action_expr is getting triggered when you close the window and then it will get all messed up. I'm not exactly sure why this happens, but the Col List Box isn't getting destroyed fast enough. As a workaroud you could maybe move the data table closing to On Close() and remove it from "Close Window" button.

 

Add this as last line

nw << On close(Close(dt, no save));

and change the button to

Button Box("Close Window",
	If(!Is Empty(PF),
		PF << Close Window
	);
	nw << Close Window;
)
-Jarmo

View solution in original post

Ressel
Level VI

Re: Error message when closing home made application via button ("Unresolved Column at row 1")

Just in case this is of any interest, the error message was caused by the use of "On Change" rather than "Set Function"  in connection with the Column List Box. The script (or at least a modified version of the one posted here) kept throwing error messages when not quit using the "Close Window" button but the eXit button in the top right corner of the window. This happened after I had added a few lines to make sure the data table is closed regardles of how the window is exited. I suspect that the "On Change" is triggered ... somewhow ...

 

Old

Panel Box( "QC parameter (y-axis)",
				stabDat = Col List Box(
					Max Selected( 1 ),
					Width( 250 ),
					N Lines( nItems ),
					On Change(   // not working so well for this application
						yColRel = Column( dt, (stabDat << Get Selected) );
						If(	Is Empty( startLevel ),
							//then
							Empty(),
							//else
							action_expr
						)
					)
				)
			)

New

Panel Box( "QC parameter (y-axis)",
				stabDat = Col List Box(
					Max Selected( 1 ),
					Width( 250 ),
					N Lines( nItems ),
					<< Set Function(   // no more error messages
						yColRel = Column( dt, (stabDat << Get Selected) );
						If(	Is Empty( startLevel ),
							//then
							Empty(),
							//else
							action_expr
						)
					)
				)
			)

 

View solution in original post

5 REPLIES 5
jthi
Super User

Re: Error message when closing home made application via button ("Unresolved Column at row 1")

I think you action_expr is getting triggered when you close the window and then it will get all messed up. I'm not exactly sure why this happens, but the Col List Box isn't getting destroyed fast enough. As a workaroud you could maybe move the data table closing to On Close() and remove it from "Close Window" button.

 

Add this as last line

nw << On close(Close(dt, no save));

and change the button to

Button Box("Close Window",
	If(!Is Empty(PF),
		PF << Close Window
	);
	nw << Close Window;
)
-Jarmo
Ressel
Level VI

Re: Error message when closing home made application via button ("Unresolved Column at row 1")

Just in case this is of any interest, the error message was caused by the use of "On Change" rather than "Set Function"  in connection with the Column List Box. The script (or at least a modified version of the one posted here) kept throwing error messages when not quit using the "Close Window" button but the eXit button in the top right corner of the window. This happened after I had added a few lines to make sure the data table is closed regardles of how the window is exited. I suspect that the "On Change" is triggered ... somewhow ...

 

Old

Panel Box( "QC parameter (y-axis)",
				stabDat = Col List Box(
					Max Selected( 1 ),
					Width( 250 ),
					N Lines( nItems ),
					On Change(   // not working so well for this application
						yColRel = Column( dt, (stabDat << Get Selected) );
						If(	Is Empty( startLevel ),
							//then
							Empty(),
							//else
							action_expr
						)
					)
				)
			)

New

Panel Box( "QC parameter (y-axis)",
				stabDat = Col List Box(
					Max Selected( 1 ),
					Width( 250 ),
					N Lines( nItems ),
					<< Set Function(   // no more error messages
						yColRel = Column( dt, (stabDat << Get Selected) );
						If(	Is Empty( startLevel ),
							//then
							Empty(),
							//else
							action_expr
						)
					)
				)
			)

 

txnelson
Super User

Re: Error message when closing home made application via button ("Unresolved Column at row 1")

A quick and dirty way to handle the issue would be to change the Close Window paragraph to ignor errors

Button Box( "Close Window",
	If( !Is Empty( PF ),
		Try( PF << Close Window )
	);
	Try( nw << Close Window );
	Try( Close( dt, no save ) );
)
Jim
Ressel
Level VI

Re: Error message when closing home made application via button ("Unresolved Column at row 1")

Thank you! As always, greatly apprciated, but still throwing an error message. @jthi's solution worked though.

hogi
Level XI

Re: Error message when closing home made application via button ("Unresolved Column at row 1")

In case anyone has a similar problem with an application generated in Application Builder.

For applications, the on close() command can be sent via 

(thisModuleInstance << Get Box) << on close(...)