创建新列并添加注释我发现 JMP 列中的 Notes 属性很有用,可以自动将标签添加到结果图中。我遇到的问题与生成与父列相关的新数据列以及让父 Notes 自动应用有关。在下面的脚本中,我希望该行
<< set property( "Notes", Notes );
可以解决问题,但我遗漏了一些东西。这是主要脚本。
Names Default To Here( 1 );
dt = Current Data Table();
colList = dt << get column names( numeric, string );
foundCols = "";
For( i = 1, i <= N Col( dt ), i++,
Spud = ":" || colList[i];
Spuds = Parse( Eval Insert( Spud ) );
Show(Spuds);
spec = Column( dt, colList[i] ) << get property( "Spec Limits" );
Notes = Column( dt, colList[i] ) << get property( "Notes" );
Show(Notes);
dt << clear select;
If( Is Empty( spec ) == 0,
dt << New Column(
(Column( dt, colList[i] ) << get name) || " % Delta From Target",
Formula(
If( Spuds > (Spuds << get property( "Spec Limits" ))["Target"],
Num(
(Spuds - (Spuds << get property( "Spec Limits" ))["Target"])
/ ((Spuds << get property( "Spec Limits" ))["USL"] - (Spuds
<< get property( "Spec Limits" ))["Target"])
) * 100,
If( Spuds < (Spuds << get property( "Spec Limits" ))["Target"],
Num(
((Spuds << get property( "Spec Limits" ))["Target"]
-Spuds) / ((Spuds << get property( "Spec Limits" ))[
"LSL"] - (Spuds << get property( "Spec Limits" ))[
"Target"]) * 100
),
0
)
)
)
) << set property( "Notes", Notes );
If( Is Missing( Try( spec["LSL"], . ) ) == 0,
dt << select where( As Column( dt, colList[i] ) + spec["LSL"] );
Try( Column( dt, N Cols( dt ) )[dt << get selected rows] = 0 );
);
If( Is Missing( Try( spec["USL"], . ) ) == 0,
dt << select where(
As Column( dt, colList[i] ) - spec["USL"],
current selection( "extend" )
);
Try( Column( dt, N Cols( dt ) )[dt << get selected rows] = 0 );
);
dt << select where(
Is Missing( As Column( dt, colList[i] ) ),
current selection( "extend" )
);
dt << invert row selection;
Try( Column( dt, N Cols( dt ) )[dt << get selected rows] = 1 );
Column( dt, N Cols( dt ) );
If( foundCols == "",
foundCols = ":Name(\!"" || (Column( dt, colList[i] ) << get name) ||
" % Delta From Target\!")",
foundCols = foundCols || ", " || ":Name(\!"" || (
Column( dt, colList[i] ) << get name) || " % Delta From Target\!")"
);
);
);
任何帮助表示感谢
再见
扳手头
自动化和脚本回复:创建新列并添加注释要么将注释设置单独设置为在新列之后发生
Names Default To Here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
For Each({colname}, dt << Get Column Names("String"),
curnote = Column(dt, colname) << Get Property("Notes");
new_col = dt << New Column("A", Character, Nominal);
new_col << Set Property("Notes", curnote);
);
或者将其移至新列内
Names Default To Here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
For Each({colname}, dt << Get Column Names("String"),
curnote = Column(dt, colname) << Get Property("Notes");
new_col = dt << New Column("A", Character, Nominal, Set Property("Notes", curnote));
);
您可以通过选择具有注释属性的列来了解脚本,右键单击标题并选择复制复制列,或者您可以创建新列并立即添加属性并从增强日志中获取脚本
Data Table("Big Class") << New Column("Column 6",
Numeric,
"Continuous",
Format("Best", 12),
Set Property("Notes", "asdasd")
);
回复:创建新列并添加注释雅尔莫
选择第二个,效果非常好!
谢谢
再见
扳手头