如何引用轉換列?當我透過發送生成轉換列時變換列到一個數據表,我得到對 Column 的引用作為返回值。
當我透過發送生成轉換列時變換列對於 GraphBuilder 對象,我得到對 Graph Builder 的引用作為返回值 - 沒有對列的引用:(
因此,詢問此「列」col2 的名稱是行不通的。
在哪裡可以找到有關引用轉換列的更多資訊?
例如,如何獲得對列的可靠參考(例如:col2)。
不必透過符號引用該列該有多好啊。 似乎可以使用列名 - 即使不帶引號(!?)
Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = dt << Graph Builder();
col1 = dt << Transform Column ("col1Name", Formula(1/:height));
col2 = gb << Transform Column ("col2Name", Formula(1/:height));
Show(Name Expr(col1));
Show(Name Expr(col2));
gb << Variables(X(:height), Y (col1));
// doesnt work :(
gb << Variables(X(:height), Y (col2));
gb << Variables(X(:height), Y ("col2Name")); //works
gb << Variables(X(:height), Y (col2Name)); // works (!?)
Show(col1 << get name());
Show(col2 << get name());
Show(Column(dt, "col1Name"));
Try(Show(Column(dt, "col2Name")), "dt doesn't know the column");
自動化和腳本編寫回覆:如何引用轉換列?Jmp 支援:TS-00056243
。您無法引用在平台上下文中建立的轉換列。這意味著您無法刪除或更換它。如果您想要引用轉換列,則必須在資料表上下文中建立該列。
因此,如果您想要變更或重新命名轉換列(在平台中),您必須透過 GUI 來完成,而不是透過 JSL。
(#透過 JSL 無法實現什麼?)
願望補充:
變換列的改進
回覆:如何引用轉換列?同時 ...
唯一的解決方案似乎是產生轉換列具有表範圍並在每次更新時將其放回繪圖中。
為了說明這個想法,我產生了一個 GraphBuilder 圖,它對所選的 M & F 進行了計數。
想像一下這種方法有多強大......
Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
colName = "count_"||Char(Random Integer(100000));
Eval(Eval Expr(gb = dt << Graph Builder(
Transform Column(
Expr(colName),
"Table Scope", // essential because otherwise the replace(1) won't work
Formula( Col Number( 1,:sex ) )
),
Variables( X( :sex ), Y( Expr(colName) ) ),
Elements( Bar( X, Y ) ),
Local Data Filter(Add Filter(columns( :sex, :name )))
)));
ldf = (Current Report()["Local Data Filter"] << get scriptable object);
myRowsOld=[];
fch = Function( {x},
myRows = ldf << Get Filtered Rows;
If( not(nrows(myRows)==nrows(myRowsOld))| not(asList(myRows) == asList(myRowsOld)),
myRowsOld = myRows;
Eval(
Substitute(
Expr(
dt << Transform Column(
_colName_,
//"Table Scope", // gb doesn't understand replace(1) -> we have to talk to the table -> no Table Scope needed
Formula(
Col Number( 1, :sex, Contains( _myRows_, Row() ) > 0 )
),
Replace( 1 )
)
),
Expr( _myRows_ ), myRows, Expr(_colName_), colName
)
);
gb << add variable({ Column(colName), Role("Y") }); //replacing the transform column removes it automatically from the graph
dt << Show Transforms();
);
);
current report() << on close(dt << delete column(colname));
rs = ldf << Make Filter Change Handler( fch );
dt << Show Transforms();
回覆:如何引用轉換列?與產生公式列相比,此方法的優點:
- 變換列只是暫時的,不會被儲存。
可比:
- 需要產生具有表格範圍的轉換列,從其他平台也可見
更差:
- 與使用真實公式列的方法相比,程式碼變得相當冗長:回覆:轉換列:排除行的錯誤
對於真正的公式列,更新輸入清單就足夠了,然後公式將重新計算。
對於轉換列,就像刪除該列並再次產生它一樣。
為什麼?
對於轉換列,可以使用
<< reset transform()
刷新值。
但令人驚訝的是,即使在刪除和新增變數之後,報告也沒有註意到更新並顯示舊值:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// transform column with table scope
global:a = 2;
dt << Transform Column(
"sqrt[height]",
Formula( global:a * Sqrt( :height ) ),
Replace(1);
);
Show( :"sqrt[height]"n[1] );
gb = Graph Builder(
Variables( X( :height ), Y( :"sqrt[height]"n ) )
);
global:a = 30;
// clear the cache
:"sqrt[height]"n << Reset Transform();
// new values
Show( :"sqrt[height]"n[1] );
wait(2);
// try to update the GraphBuilder
gb << remove variable(2);
wait(2);
// unfortunately, still the old values !?!?!
gb << add variable({:"sqrt[height]"n, Role("Y")});
// a new GraphBuilder starts with updated values !
gbnew = Graph Builder(
Variables( X( :height ), Y( :"sqrt[height]"n ) )
);
新產生的圖形產生器報告(國標新) 顯示新值。
-> 似乎第一個圖形產生器使用一些儲存的值,這些值在刷新轉換列時不會刷新。
回覆:如何引用轉換列?這算不算一個解決方案?
嗯…
Jmp支援[TS-00056243]非常清楚:
簡而言之,沒有辦法透過更改本地資料過濾器來更改轉換列
[我們中的一個]一直在與其他人合作解決該問題的技術支援和開發,但沒有可用的解決方案。
回覆:如何引用轉換列?不是透過更改本機資料過濾器來更改轉換列的方法
還沒有 ...