嵌套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]
);