Crystal 8.5 - SQL generated by 'Select Expert' loses logical meaning
From: Oli Ollerenshaw (mroshaw_at_ukonline.co.uk)
Date: 07/16/04
- Next message: Dan3D: "Re: Custom line color in grid"
- Previous message: Corobori: "Problem with A6 format in Crystal Report"
- Messages sorted by: [ date ] [ thread ]
Date: 16 Jul 2004 00:08:34 -0700
Hello,
I have created the following formula in Crystal 8.5:
({S_SRV_REQ.X_QA_HELD_DATE} in {?Start Date} to {?End Date})
Or
(ISNULL({S_SRV_REQ.X_QA_HELD_DATE}) And
ISNULL({S_SRV_REQ.X_HELD_FLAG}))
i.e. this should return True if EITHER of the bracket enclosed AND
statements are True.
This is translating to the following ODBC (Oracle) SQL:
(S_SRV_REQ."X_QA_HELD_DATE" >= {ts '2004-07-14 00:00:00.00'} AND
S_SRV_REQ."X_QA_HELD_DATE" < {ts '2004-07-15 00:00:00.00'} OR
S_SRV_REQ."X_QA_HELD_DATE" IS NULL AND
S_SRV_REQ."X_HELD_FLAG" IS NULL)
As you can see, Crystal is stripping out the brackets surrounding the
two separate AND clauses. The correct SQL should be:
((S_SRV_REQ."X_QA_HELD_DATE" >= {ts '2004-07-14 00:00:00.00'} AND
S_SRV_REQ."X_QA_HELD_DATE" < {ts '2004-07-15 00:00:00.00'}) OR
(S_SRV_REQ."X_QA_HELD_DATE" IS NULL AND
S_SRV_REQ."X_HELD_FLAG" IS NULL))
The two SQL statements have different logical meanings and the results
of the report are incorrect:
should be:
(x AND y) OR (a AND b)
Crystal is evaluating this as:
x AND y OR a AND b = ((x AND y) OR a) AND b
Can anyone tell me how to force Crystal to translate this formula
correctly, without having to resort to manually updating the SQL
(which works, incidentally) and thereby losing the benefits of the
Select Expert?
Cheers!
mroshaw
- Next message: Dan3D: "Re: Custom line color in grid"
- Previous message: Corobori: "Problem with A6 format in Crystal Report"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|