2014-03-19 41 views
0

我有一個.rpt文件,與視圖數據源。我有四個參數用於過濾選擇。我寫下了我的選擇公式,如下所示。嵌套,如果其他條件在水晶報告

if ({?actype} <> "All") OR ({?actype} <> "All") OR ({?collectorname} <> "All") OR ({?batchno}<> "All") Then 
(
if {?actype} <> "All" Then 
    {CollectorPerformance.accountType} = {?actype}; 
if {?collectorname} <> "All" Then 
    {CollectorPerformance.realname} = {?collectorname}; 
if {?batchno} <> "All" Then 
    {CollectorPerformance.batchno} = {?batchno} 

and 
{CollectorPerformance.clientid} = {?clientid} 
and 
Date({CollectorPerformance.paymentdate}) >= Date({?from}) 
and 
Date({CollectorPerformance.paymentdate}) <= Date({?to}) 

) 

我的問題與上面的公式,它不會過濾realname和actType。我明白原因是因爲關鍵詞「和」缺失。然而,它正確過濾batchno>請如何使其餘的兩個過濾如果是?任何幫助將不勝感激。

回答

1

一個選擇公式必須是一個長的有效布爾語句,也就是我認爲,當你說「和缺失」時你已經建議了什麼。因此,爲了解決前半部分問題,您只需要將這些語句翻譯爲一個簡化布爾語句而不是單個語句(以';'結尾)。

({?actype}="All" or {?actype}={CollectorPerformance.accountType}) 
and 
({?collectorname}="All" or {?collectorname}={CollectorPerformance.realname}) 
and 
({?batchno}="All" or {?batchno}={CollectorPerformance.batchno}) 
... 

對於每個參數,用戶可以選擇「全部」或輸入特定值進行過濾。如果選擇「全部」,語句的特定部分(看起來像{?Parameter}="All"的部分)將評估爲True,並且不會執行過濾。否則,只有匹配輸入參數值的記錄纔會返回True