Skip to Content
0

"Date is required here" exception is thrown for SQLExpression in RecordSelection formula

Nov 29, 2016 at 11:51 PM

47

avatar image

Hi,

We have added SQL expression named "Today1" using RAS (reportclientdocument). SQLExpression returns current date.

Crystalrreport Engine is not able to recognize SQL expression "Today1" as Date data type.

Following condition is added to ReportSelectinFormula boReportDocument.DataDefinition.RecordSelectionFormula = "Date(2016, 11, 30) = {%Today}";

When we run report, it throws following exception.

"Date is required here"

exception is thrown for SQLExpression in RecordSelectionformula

Code Snippet boReportClientDocument.DataDefController.FormulaFieldController.AddByName("Today1", "SYSDATE", CrFormulaSyntaxEnum.crFormulaSyntaxSQL);

string error = boReportClientDocument.DataDefController.FormulaFieldController.Check(formulaField);

boReportDocument.DataDefinition.RecordSelectionFormula = "Date(2016, 11, 22) = {%Today1}";

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Brian Dong Nov 30, 2016 at 05:21 PM
0

Hi Sandeep,

I'm wondering if the SQLExpression is returning a DateTime instead of Date. Try using CDate around it like:

boReportDocument.DataDefinition.RecordSelectionFormula = "Date(2016, 11, 22) = CDate ({%Today1})";

Brian

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thanks Brian for the response, however data type is date itself. I face same problem even for Numeric data types. SQLExpression is created by default with String data type and does not anticipate that its contents are returning date field.

0