嗨 - 我是 jsl 脚本的新手,我正在尝试构建一个 jsl 语句,如下所示:
如果 A 列为空,则 C 列 = 空,
否则如果 A 列 < 500 且 B 列 = 200,C 列 = 0,
否则,如果 A>500 列,C 列 = 1。
我将如何构建一个 jsl 公式来做到这一点?谢谢!
这是我在彻底搜索 jsl 索引、帮助菜单和 google 以及大量反复试验后得出的结论......但它没有奏效。我的 C 列公式是:
公式 (
If (ismissing (:column A), empty(),
:column A< 500 & :column B == 200, 1,
:columnA>500, 0
))
@Campbell_Ted_R
尝试这个:
names default to here (1);
dt = Current data table();
dt << new column ("C","Numeric", "ordinal", Formula (If(
Is Missing( :A ),.,
:A < 500 & :B == 200, 0,
:A > 500, 1
)));
谢谢罗恩。由于某种原因,“空”条件未注册。也就是说,如果 :A 为空,则 :C 为 1。
??
它现在识别空单元格并将它们正确填充为空 (yay),正确解释第二个条件并适当地设置 0,但它不会使其成为第三个 (else if) 条件。也就是说,它永远不会是 1,即使有很多时候它应该是。
这个对吗?
New Table( "Untitled",
Add Rows( 12 ),
New Column( "A",
Numeric,
"Continuous",
Format( "Fixed Dec", 12, 0 ),
Set Values( [., ., 400, 400, 550, 550, ., ., 400, 400, 550, 550] )
),
New Column( "B",
Numeric,
"Continuous",
Format( "Fixed Dec", 5, 0 ),
Set Values( [200, 61, 200, 66, 200, 60, 200, 51, 200, 61, 200, 65] )
),
New Column( "C",
Numeric,
"Ordinal",
Format( "Best", 10 ),
Formula( If( Is Missing( :A ), ., :A < 500 & :B == 200, 0, :A > 500, 1 ) ),
Set Selected
)
);