嵌套if语句
嗨,
我只是想确保以下嵌套的if语句能够正常运行。目前我收到一个错误,所以我认为这可能与我构建嵌套if语句的方式有关:
If (ismissing(dt:newColumnName[k]), For Each Row(If(dt:colAutomatically <= colManually[k] & dt:colAutomatically >= colManuallyStart[k], dt:newColumnName = colInstructions[k], dt: newColumnName = colInstructions[k-1] || " & " || colInstructions[k]));
if语句的conidtion是:
(ismissing(dt:newColumnName[k])
如果这是真的,我想要运行以下语句:
For Each Row(If(dt:colAutomatically <= colManually[k] & dt:colAutomatically >= colManuallyStart[k], dt:newColumnName = colInstructions[k]
如果这是假的,我想要运行以下语句:
dt: newColumnName = colInstructions[k-1] || " & " || colInstructions[k]));
任何帮助,将不胜感激。
Re:嵌套if语句嗨,
谢谢你的回复,但我想要以下声明:
dt:newColumnName = colInstructions[k - 1] || " & " || colInstructions[k];
进入循环。
那有什么办法吗?
Re:嵌套if语句如果第一个参数求值为false,则要计算的表达式位于For Each Row()函数内。这个代码结构应该做你想要的:
If( Is Missing( dt:newColumnName[k] ),
For Each Row(
If( dt:colAutomatically <= colManually[k] & dt:colAutomatically >= colManuallyStart[k],
dt:newColumnName = colInstructions[k]
)
),
dt:newColumnName = colInstructions[k - 1] || " & " || colInstructions[k]
);