2014-11-20 37 views
0

我有以下Crystal報告公式,但它只取第一個IF條件並忽略所有其他ELSE IF s。請幫忙。Crystal報告公式ELSE如果不起作用

IF {CCS_ScheduleMatrixRpt;1.period2} [(InStr ({CCS_ScheduleMatrixRpt;1.period2}, ";") - 1)] = "1" Then 
{CCS_ScheduleMatrixRpt;1.period2} [(InStr ({CCS_ScheduleMatrixRpt;1.period2}, " ") + 1) To Length ({CCS_ScheduleMatrixRpt;1.period2})] 
ELSE IF {CCS_ScheduleMatrixRpt;1.period3} [(InStr ({CCS_ScheduleMatrixRpt;1.period3}, ";") - 1)] = "1" Then 
{CCS_ScheduleMatrixRpt;1.period3} [(InStr ({CCS_ScheduleMatrixRpt;1.period3}, " ") + 1) To Length ({CCS_ScheduleMatrixRpt;1.period3})] 
ELSE IF {CCS_ScheduleMatrixRpt;1.period5} [(InStr ({CCS_ScheduleMatrixRpt;1.period5}, ";") - 1)] = "1" Then 
{CCS_ScheduleMatrixRpt;1.period5} [(InStr ({CCS_ScheduleMatrixRpt;1.period5}, " ") + 1) To Length ({CCS_ScheduleMatrixRpt;1.period5})] 
ELSE IF {CCS_ScheduleMatrixRpt;1.period1} [(InStr ({CCS_ScheduleMatrixRpt;1.period1}, ";") - 1)] = "1" Then 
{CCS_ScheduleMatrixRpt;1.period1} [(InStr ({CCS_ScheduleMatrixRpt;1.period1}, " ") + 1) To Length ({CCS_ScheduleMatrixRpt;1.period1})] 
ELSE IF {CCS_ScheduleMatrixRpt;1.period6} [(InStr ({CCS_ScheduleMatrixRpt;1.period6}, ";") - 1)] = "1" Then 
{CCS_ScheduleMatrixRpt;1.period6} [(InStr ({CCS_ScheduleMatrixRpt;1.period6}, " ") + 1) To Length ({CCS_ScheduleMatrixRpt;1.period6})] 
ELSE IF {CCS_ScheduleMatrixRpt;1.period7} [(InStr ({CCS_ScheduleMatrixRpt;1.period7}, ";") - 1)] = "1" Then 
{CCS_ScheduleMatrixRpt;1.period7} [(InStr ({CCS_ScheduleMatrixRpt;1.period7}, " ") + 1) To Length ({CCS_ScheduleMatrixRpt;1.period7})] 
ELSE IF {CCS_ScheduleMatrixRpt;1.period8} [(InStr ({CCS_ScheduleMatrixRpt;1.period8}, ";") - 1)] = "1" Then 
{CCS_ScheduleMatrixRpt;1.period8} [(InStr ({CCS_ScheduleMatrixRpt;1.period8}, " ") + 1) To Length ({CCS_ScheduleMatrixRpt;1.period8})] 
ELSE IF {CCS_ScheduleMatrixRpt;1.period1} [(InStr ({CCS_ScheduleMatrixRpt;1.period1}, ";") - 1)] = "1" Then 
{CCS_ScheduleMatrixRpt;1.period1} [(InStr ({CCS_ScheduleMatrixRpt;1.period1}, " ") + 1) To Length ({CCS_ScheduleMatrixRpt;1.period1})] 
+0

您的第一個'IF'始終是真實的你的病情..檢查即將公式的數據.. – Siva 2014-11-21 04:28:32

回答

0

也許1st如果始終爲真,那麼請嘗試更改其他人的順序,如果將第一個作爲最後一個。您還可以在下面,如果重複2ice

IF {CCS_ScheduleMatrixRpt;1.period1} [(InStr ({CCS_ScheduleMatrixRpt;1.period1}, ";") - 1)] = "1" 
Then {CCS_ScheduleMatrixRpt;1.period1} [(InStr ({CCS_ScheduleMatrixRpt;1.period1}, " ") + 1) To Length ({CCS_ScheduleMatrixRpt;1.period1})] 
+0

專家你好...可以有人幫助呢?我試過建議的選項仍然有問題。謝謝。 – hets 2014-11-21 14:01:50

+0

嘗試評論第一個IF,看看會發生什麼? – cojimarmiami 2014-11-21 14:04:52

+0

然後沒有得到顯示,因爲它們不符合IF條件。如果我在中間或末尾有第一個IF,它不會顯示任何內容,因爲IF不會被執行。謝謝。 – hets 2014-11-21 14:55:28