我曾尝试在帮助指南中查找此内容,但看起来我正确地应用了它,但似乎没有用。有人可以检查我是否缺少什么吗?
我有一列是从另一列创建的,并四舍五入了值。我只需要根据新列中的值保留一定范围的行。我只想保留介于50000和50999之间的New Y值,并删除其余的行。
这是我的脚本中具有此命令的部分,但不起作用。您可以在我正在处理的当前行之前看到已注释掉的行,但是现在可能需要保留50000范围内的其他值。
如果需要,我还附上了我的整个脚本作为参考。
dt = Current Data Table();
Column( dt, "X coordinate" ) << data type( Numeric ) << Modeling Type( Continuous ) << Format( Best, 12 );
dt << New Column( "New Y", Numeric, Nominal, Width( 5 ), Formula( Round( Y coordinate ) ) );
//dt << select where( :New Y != 50503 );
dt << select where( :New Y < 50000 & :New Y > 50999 );
dt << delete rows;
dt << New Column( "Normalized", Numeric, Continuous, Width( 10 ), Precision( 7 ), Formula( IntenCD / Col Max( IntenCD ) ) );
在此先感谢您的任何帮助。
Clear Symbols();
Names Default To Here( 1 );
framex_value = "";
lotid_value = "";
w = New Window( "Requested Information", // opens a window with a title and this content...
<<RETURN result=""> 50999 );
dt << delete rows;
dt << New Column( "Normalized", Numeric, Continuous, Width( 10 ), Precision( 7 ), Formula( IntenCD / Col Max( IntenCD ) ) );
// Determine Matrix
xMat = Matrix( 76200 - (framex_value / 2) ) |/ Matrix( 76200 - (framex_value / 2) ) |/ Matrix( 76200 + (framex_value / 2) ) |/
Matrix( 76200 + (framex_value / 2) );
// The yMat is static
yMat = [1, 0.92, 0.92, 1];
// The overall delta
overallDelta = Col Max( dt:Normalized ) - Col Min( dt:Normalized );
//The delta between the lines
withinOrangeDelta = Col Max(
If( dt:X coordinate > (76200 - (framex_value / 2)) & dt:X coordinate < (76200 + (framex_value / 2)),
dt:Normalized,
.
)
) - Col Max( dt:Normalized ) - Col Min( dt:Normalized ) + 1;
Col Min( If( dt:X coordinate > (76200 - (framex_value / 2)) & dt:X coordinate < (76200 + (framex_value / 2)), dt:Normalized, . ) );
// Graph Builer and Delta display
gb = dt << Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( X( dt:X Coordinate ), Y( dt:Normalized ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
);
Report( gb )[FrameBox( 1 )] << Add Graphics Script(
Pen Color( "orange" );
Pen Size( 2 );
Line( xmat, ymat );
// Add the results to the chart
Text( Boxed, {75000, .94}, "Overall Delta = " || Char( Format( overallDelta, 7, 4 ) ) );
Text( Boxed, {75000, .93}, "Within Frame Delta = " || Char( Format( withinOrangeDelta, 7, 4 ) ) );
);
Report( gb )[AxisBox( 2 )] << Min( .91 );
Report( gb )<<SAVE picture=""></SAVE></RETURN>
我认为这只是一个逻辑问题。
您的select where语句:
dt << select where( :New Y < 50000 & :New Y > 50999 );
永远不能成立,因为:新Y不能小于50000 和同时大于50999。
相反,您想要:
dt << select where( 50000 <= :New Y <= 50999 );
天哪,谢谢。确实有道理。我用新行替换了代码,但实际上并没有删除所有其他需要删除的行,因此我只绘制了50000至50999之间的New Y值。我还能缺少什么?
嗨,我仍然无法弄清楚如何删除除特定范围的Y坐标之外的所有坐标。借助先前帮助的更新,这是我正在处理的部分的新脚本。因此,我只需要保留从50000到50999的Y值,然后删除其余的值。
dt = Current Data Table();
Column( dt, "X coordinate" ) << data type( Numeric ) << Modeling Type( Continuous ) << Format( Best, 12 );
dt << New Column( "New Y", Numeric, Continuous, Width( 10 ), Formula( Round( Y coordinate, 0 ) ) );
//dt << select where( :New Y != 50503 );
dt << select where( 50000 <= :New Y <= 50999 );
dt << delete rows;
dt << New Column( "Normalized",
Numeric,
Continuous,
Width( 10 ),
Precision( 7 ),
Formula( IntenCD / Col Max( IntenCD ) )
);