Search code examples
crystal-reportssql-like

Use like operator in Crystal Report record selection formula


Hi I am using Crystal Report 2008 to create a report. I need to convert the following oracle SQL query to Crystal Report record selection formula.

Oracle Query is :

AND 
(
  UPPER(920_SEARCH_REPORT.HANDICAP_TYPE) LIKE UPPER(:HANDICAP_TYPE)
  OR UPPER(920_SEARCH_REPORT.SKSKODENR) LIKE UPPER(:SKSKODENR)
)

I have convert this to formula like following way :

and 
(
    isnull({?Hancicap_Type}) = true 
        or ((UpperCase({?Hancicap_Type}) Like ("*"&UpperCase({920_SEARCH_REPORT.HANDICAP_TYPE})&"*"))    
        or (UpperCase({?SKSKODENR}) Like ("*"&UpperCase({920_SEARCH_REPORT.SKSKODENR})&"*")))
)

But data is not showing when crystal report executes. But the sql query returns one record.

Can anyone help me to solve the problem.


Solution

  • You need to use the proper syntax for parameters: {?parameter_name}.

    ...
    AND 
    (
      ( UPPER(920_SEARCH_REPORT.HANDICAP_TYPE) LIKE "*" + UPPERCASE({?HANDICAP_TYPE}) + "*")
      OR 
      ( UPPER(920_SEARCH_REPORT.SKSKODENR) LIKE "*" + UPPERCASE({?SKSKODENR}) + "*")
    )