Kbase P152533: Setting Crystal RDC RecordSelectionFormula property generates errors when executing a report created
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/09/2009 |
|
Status: Unverified
SYMPTOM(s):
Setting Crystal RDC RecordSelectionFormula property generates errors when executing a report created with Crystal Reports 2008
Crystal Reports ActiveX RecordSelectionFormula property results errors when executing a report created with Crystal Reports 2008
Error occurred while accessing component property/method: RecordSelectionFormula
This field name is not known.
Error code: 0x80020009 (5890)
This field name is not known.
Fields specified in the RecordSelectionFormula use the table name specified in the database and not the table name alias created by Crystal Reports 2008
Example RecordSelectionFormula:
chReport:RecordSelectionFormula = STRING("~{customer.custnum} >= 1 AND ~{customer.custnum} <= 10").
FACT(s) (Environment):
Report created with Crystal Reports 2008
Problem does not occur when running reports created with an earlier version of Crystal Reports
SQL query generated for Crystal Reports 2008 is the same as the SQL query generated in earlier versions of Crystal Reports
Example SQL query generated by Crystal Reports 2008:
SELECT "Customer1"."CustNum", "Customer1"."Name", "Customer1"."City", "Customer1"."State", "Customer1"."Country"
FROM "PUB"."Customer" "Customer1"
Table name stored in the report created with Crystal Reports 2008 is the table name alias
Table name stored in the report created with Crystal Reports XI Release 2 and lower is the table name used in the database
ODBC tracing reports the use of the table 'Customer', not 'Customer1', in both versions of Crystal Reports when creating a report
OpenEdge Category: SQL
OpenEdge 10.1x
OpenEdge 10.2A
Windows
Crystal Reports 2008
CHANGE:
Upgraded to Crystal Reports 2008
CAUSE:
The errors is caused by a change in behaviour of the Business Objects Crystal Reports 2008 product. Crystal Reports XI Release 2 and lower store the name of the table as it appears in the database in the report. Crystal Reports 2008 stored the table name alias in the report. The field used in the RecordSelectionFormula cannot be found because the code generating the RecordSelectionFormula uses the database table name; the report query is using (for example) "Customer1" but the RecordSelectionFormula specifies "Customer".
FIX:
Option #1
Change the table name stored in the report at runtime. For example:
chReport:Database:Tables(1):NAME = "customer".
This is just a simple statement to change 1 table name but it can/should be modified to do the same for all tables in the report. For example, a basic way of doing this would be to strip out the number "1" used in table aliases to leave the original table name:
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DO i = 1 TO chReport:Database:Tables:COUNT:
chReport:Database:Tables(i):NAME = REPLACE(chReport:Database:Tables(i):NAME, "1", "").
END.
Option #2
Contact SAP/ Business Objects Technical Support for further assistance with addressing the change in behaviour in Crystal Reports 2008