how to use wildcard in Crystal report selection expert

ぃ、小莉子 提交于 2019-12-24 19:07:33

问题


i found this on another forum

set your default value 'ALL' for parameter

add if statement to Select Expert:

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

that didnt work, for some reason it isnt using the date constraints. So then i tried the following.

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

that works great if i use an actual part number, but when i use the defaul ALL it doesnt work at all.

this is my complete selection formula:

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

anyone know how to either make the mentioned answer on this forum work with dates or how ot make this way work?


回答1:


Try:

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



回答2:


I had a problem with what you recommended, but i found this answer.

This is how it works, it checks to see if PartNbr is equal to 'All'. If it does then it skips to the date restraints. By skipping, it will in turn select all the parts in that date range. if PartNbr doesn't equal 'All', it will take PartNbr and get the parts with that number within the date range.

This solution worked great for me, just htought id update if someone came by

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


来源:https://stackoverflow.com/questions/6295588/how-to-use-wildcard-in-crystal-report-selection-expert

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!