建立新列並新增註釋我發現 JMP 列中的 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")
);
回覆:建立新列並新增註釋雅爾莫
與第二個一起去,效果很好!
謝謝
再見
扳手頭