我正在使用一个函数根据不同条件创建多个图。 有时它要求我排除(极端值)行,以便在向客户展示该图时更好地拟合该图。我试图使用全局标志来设置是否需要删除该框,但是正如我发现的那样昨天,当标志将为1时可能出现,但是测试条件没有Textbox(5)。
文本框自动获得其自己的幻灯片,因此我需要将其删除。
任何帮助,将不胜感激
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" );
);我不确定你的问题是什么。 但是,如果您说当检测到excludeFlag == 1并导致问题时,有时Text Box(5)不存在,则可以使用Try()函数来解决此问题。
If( excludeFlag == 1, Try( Report( gb )[Text Box( 5 )] << Delete) );
如果不确定删除是否成功,而是导致错误情况,则可以将其用作Try()函数的参数。可能没有任何文本框对象,或者可能有多个。如果您找到第一个文本,我将对其进行检查,以确保它是您要删除的文本。
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." );
);