如何引用转换列?当我通过发送生成转换列时变换列到一个数据表,我得到对 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]非常清楚:
简而言之,没有办法通过更改本地数据过滤器来更改转换列
[我们中的一个]一直在与其他人合作解决该问题的技术支持和开发,但没有可用的解决方案。
回复:如何引用变换列?无法让转换列随着本地数据过滤器的改变而改变
还没有 ...