function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BrunoMBrunoM 

Malformed Query Using Crystal Reports

Hello All,

 

Not sure if this is the right forum, but I am encountering a problem writing a particular query using Crystal Reports 11.2 with Salesforce.

 

I am using the Salesforce.com Driver for Crystal Reports ver 3.0 to connect.

 

An example of query I have written is:

 

{Case.CreatedDate} <= CDATETIME({?Date})and (isnull({Case.ClosedDate}) or {Case.ClosedDate} > CDATETIME({?Date}))

 

 

Now if I input a date of 2011-02-01 as my date parameter and then run the report, I get the following error:

 

Failed to retrieve data from the database

 

Database Connector Error: 'MALFORMED_QUERY:

CreatedDate<2010-02-01TO0:00:01Z AND ( OR ClosedDate >=2010-02-01T00:00:01Z)

 

ERROR at Row:1:Column:90

unexpected token: 'OR"

 

 

When I use the 'Show SQL query' function in Crystal, this is what is shows me

 

SELECT CreatedDate, ClosedDate FROM   Case WHERE  CreatedDate<2010-02-01T00:00:01Z AND ( OR ClosedDate>=2010-02-01T00:00:01Z)

 

It seems like it doesn't like the 'or' value in the query. If I break up the query and write it as 2 queries:

 

{Case.CreatedDate} <= CDATETIME({?Date})and isnull({Case.ClosedDate}) 

 

 

{Case.CreatedDate} <= CDATETIME({?Date})and {Case.ClosedDate} > CDATETIME({?Date})

 

then it seems to have no problem at all - which doesn't help me a whole lot.

 

Any ideas what I could be doing wrong here?

 

Any help is appreciated.