2011-06-09 79 views
0

我發現這在另一個論壇如何使用通配符在Crystal報表選擇專家

設置默認值「ALL」的參數

添加if語句來選擇專家:

If {?Parameter}='ALL' 
Then {Database.Field} like '*' 
Else {Database.Field} = {?Parameter} and 
{fctime_ts} >= {@StartDate} and 
{fctime_ts} < {@EndDate} 

那沒有工作,由於某種原因它不使用日期限制。所以然後我嘗試了以下。

{fpartno} = IIF({?PartNbr} = 'All', '*' , {?PartNbr}) 

如果我使用的實際部件數的偉大工程,但是當我使用了defaul ALL它沒有在所有的工作。

這是我的完整選擇公式:

fpartno} = IIF({?PartNbr} = 'All', '*' , {?PartNbr}) and 
{fctime_ts} >= {@StartDate} and 
{fctime_ts} < {@EndDate} 

人知道如何可以使所提的答案在這個論壇工作的日期或OT如何讓這樣的工作?

回答

0

我跟你推薦什麼問題,但我發現這個答案。

這是如何工作的,它檢查PartNbr是否等於'全部'。如果確實如此,則跳至日期限制。通過跳過,它將依次選擇該日期範圍內的所有部分。如果PartNbr不等於「全部」,它將採用PartNbr並在日期範圍內獲取具有該編號的部分。

該解決方案爲我工作很好,只是htought ID更新,如果有人走過來

({?PartNbr} = 'All' 
or 
{?PartNbr}= {intran.fpartno}) and 
{intran.fctime_ts} >= {@StartDate} and 
{intran.fctime_ts} <= {@EndDate} 
0

嘗試:

(If {?Parameter}='ALL' Then 
    {Database.Field} LIKE '*' 
Else 
    {Database.Field} = {?Parameter} 
) 
and {fctime_ts} >= {@StartDate} 
and {fctime_ts} < {@EndDate}