I have a formula in the Main report that builds the SQL where clause (for MS SQL Server) to be passed to the subreport.
Query generated by Crystal in the subreport is the following:
SELECT
UNIFIER__COSTCOMRPT.PROGRAMNO, UNIFIER__COSTCOMRPT.PROGRAM, UNIFIER__COSTCOMRPT.AMOUNT, UNIFIER__COSTCOMRPT.MYTYPE, UNIFIER__COSTCOMRPT.project_id, UNIFIER__COSTCOMRPT.PROJECTNO, UNIFIER__COSTCOMRPT.PROJECT, UNIFIER__COSTCOMRPT.EFDATE, UNIFIER__COSTCOMRPT.CODE, UNIFIER__COSTCOMRPT.ITEM, UNIFIER__COSTCOMRPT.WO, UNIFIER__COSTCOMRPT.PROJTYPE
FROM unifier.dbo.unifier__costcomrpt UNIFIER__COSTCOMRPT
WHERE UNIFIER__COSTCOMRPT.project_id=1019
AND
UNIFIER__COSTCOMRPT.EFDATE<{ts '2012-05-30 00:00:00'}
AND
UNIFIER__COSTCOMRPT.WO=
SQL string built in the main report formula and passed as a parameter (called
{?Pm-@WO_Selection_Formula}) to the subreport looks like this:
HA1191' OR WO = 'HA1194' OR WO = 'HA1273
The selection formula in the subreport is the following:
when the complete SQL is generated in the subreport there are extra single quotes added into the Where clause as shown below that cause the subreport to not select any data:
AND
UNIFIER__COSTCOMRPT.WO=' HA1191'' OR WO = ''HA1194'' OR WO = ''HA1273 '
I have tried manipulating the quotes in the parameter being passed but can't seem to get the quotes to generate properly.
what causes these extra quotes to be generated?
Is there any solution for this?
Thanks!