I am using a Function to create multiple plots based on different conditions. Sometimes it calls for me to exclude (extreme outliers) rows in order to better fit the graph when presenting it to our customers.I tried to use a global flag to set whether or not it that box needs to be deleted but as i found out yesterday there are possibilites when the flag will = 1 however the test condition has no Textbox( 5 ).
The text box automattically gets its own slide so I need to remove it.
Any help would be appreciated
GraphPlot = Function(
{dt, Yaxis },
Eval(
Substitute(
Expr(
gb = dt << Graph Builder(
Invisible,
Where( dt:chnl == chan & dt:astate == attn & dt:pstate == phas ),
// Size( 1440, 1040 ),
show control panel( 0 ),
show legend( 0 ),
Subtitle Alignment( "Left" ),
Show Subtitle( 1 ),
Variables(
Y( Eval( Yaxis ) ),
X( :FREQ_GHz ),
Group X( :wafer_number ),
Overlay( :RowCol )
),
Elements( Smoother( X, Y, legend( 19 ), lambda( 0.0001 ) ) ),
)
),
Expr( plot ), plot,
Expr( chan ), chan,
Expr( attn ), attn,
Expr( phas ), phas,
Expr( mode ), mode,
Expr( tst ), tst
)
);
Report( gb )[Axisbox( 1 )] << Min( 7 ) << Inc( 1 ) << Add Ref Line( 8, "Solid", "Black", "m106", 1 ) << Add Ref Line( 17.5, "Solid", "Black", "m105", 1 ) << Label Row( Show Major Grid( 1 ) );
Report( gb )[Axisbox( 2 )] << Inc( 2 ) << Minor Ticks( 1 ) << Label Row( Show Major Grid( 1 ) );
(gb << Top Report)[Text Box( 1 )] << Delete;
// This may or may not happen on every condition
// I tried creating a flag when i actually exclude parts however
// The flag is global and not specific on a test condition
If( excludeFlag == 1, Report( gb )[Text Box( 5 )] << Delete );
Report( gb )[Framebox( 1 )] << Frame Size( 781, 655 );
Report( gb )[Outline Box( 1 )] << Set Title( Eval Insert( WaferListSQLString || " ^tst^" ) );
Report( gb )[Text Edit Box( 2 )] << Set Font Size( 15 ) << Set Font Style( "Bold" );
Report( gb )[Text Edit Box( 1 )] << Set Font Size( 25 ) << Set Font Style( "Bold" );
);I am not exactly sure what your question is. But if you are saying that sometimes Text Box(5) is not there when you have detected an excludeFlag == 1 and that is causing an issue, then you can resolve that by using a Try() function
If( excludeFlag == 1, Try( Report( gb )[Text Box( 5 )] << Delete) );
If you are not sure if the deletion will succeed but instead cause an error condition, you might use it as an argument to the Try() function. There might not be any Text Box objects or there might be more than one. I would check the text if you find the first one to be sure that it is the one you want to delete.
Try(
text = (gb << Top Report)[Text Box( 1 )] << Get Text;
If( Contains( text, "what I am looking for" ),
(gb << Top Report)[Text Box( 1 )] << Delete;
),
Throw( "No text box found." );
);