2015-02-11 82 views
-1

我有一個水晶報告,我正在轉換成SSRS,並且有一個重要的函數具有多個ELSE IF語句。有沒有辦法讓這個在ssrs中工作?如果聲明與其他多個if語句在ssrs

IF ({Command.FOLDERTYPE}= 'PC' and 
//1950 - SUB - MAJ FACILITIES SUBDIVISION, 1260 - SUBDIVISION 
({Command.SUBCODE} = 1950) or {Command.SUBCODE} = 1260) 
OR (({Command.FOLDERTYPE} = 'GD' and {Command.SUBCODE} = 900) //900 - Public Construction 
or ({Command.FOLDERTYPE} = 'WA' and {Command.SUBCODE} = 900) 
or ({Command.FOLDERTYPE} = 'SS' and {Command.SUBCODE} = 900) 
or ({Command.FOLDERTYPE} = 'SD' and {Command.SUBCODE} = 900) 
or ({Command.FOLDERTYPE} = 'ST' and {Command.SUBCODE} = 900)) THEN 
'Subdivision' 
ELSE IF ({Command.FOLDERTYPE} = 'CO') 
OR (({Command.FOLDERTYPE} = 'WA' and {@SubtypeCommercial} = true) 
or ({Command.FOLDERTYPE} = 'SS' and {@SubtypeCommercial} = true) 
or ({Command.FOLDERTYPE} = 'SD' and {@SubtypeCommercial} = true) 
or ({Command.FOLDERTYPE} = 'ST' and {@SubtypeCommercial} = true) 
or ({Command.FOLDERTYPE} = 'PC' and {@SubtypeCommercial} = true) 
or ({Command.FOLDERTYPE} = 'GD' and {@SubtypeCommercial} = true)) THEN 
'Commercial' 
ELSE IF ({Command.FOLDERTYPE} = 'SF') 
OR (({Command.FOLDERTYPE} = 'WA' and {Command.SUBCODE} = 1210) //1210 - singe family 
or ({Command.FOLDERTYPE} = 'SS' and {Command.SUBCODE} = 1210) 
or ({Command.FOLDERTYPE} = 'SD' and {Command.SUBCODE} = 1210) 
or ({Command.FOLDERTYPE} = 'ST' and {Command.SUBCODE} = 1210) 
or ({Command.FOLDERTYPE} = 'GD' and {Command.SUBCODE} = 1210)) THEN 
'Single Family' 
ELSE IF {Command.FOLDERTYPE} = 'II' OR ({Command.FOLDERTYPE} = 'FR') THEN 
'Miscellaneous' 
ELSE IF {Command.FOLDERTYPE} = 'GD' THEN 
'Grading Permit - No subtype' 
+0

查看SSRS中的SWITCH語句。 – 2015-02-11 19:27:57

+0

我會建議你在SQL查詢本身中調整所有條件。並從數據庫中獲取所有格式化和計算的數據。如果這不在你的手中,那麼使用'CASE',因爲在這種情況下,將比'IIF'更容易跟蹤。 – 2015-02-12 06:37:03

回答

1

是的,最簡單的方法是在表達式中嵌套IIF:

=iif([first condition], [result if true], iif([second condition], [result if first condition not true, and 2nd is true], [result if neither are true)) 

這只是兩個條件是很明顯,但可以繼續窩IIF以同樣的方式超出了陳述。