
09-28-2009 05:17 AM
Hi,
We're currently experiencing some weird issues with launching a crystal report from a button on the SLX account screen. In the report there is one parameter for an account number, which is being passed over and the report itself is based on a view using custom data we've pulled in from an accounting system.
The issue is that the first time the report is launched it executes the following SQL..
SELECT "v_NewSalesReportView"."C_THEIR_REFERENCE", "v_NewSalesReportView"."ACCOUNT", "v_NewSalesReportView"."ACCOUNT_NUMBER", "v_NewSalesReportView"."ANALYSIS1", "v_NewSalesReportView"."C_ITEM_NUMBER", "v_NewSalesReportView"."C_TRANSACTION_DATE", "v_NewSalesReportView"."C_ORDER_NUMBER", "v_NewSalesReportView"."C_INVOICE_NUM_TEXT", "v_NewSalesReportView"."C_ALTERNATE_PART", "v_NewSalesReportView"."C_EXCHANGE_RATE", "v_NewSalesReportView"."C_PRICE", "v_NewSalesReportView"."C_ITEM_DISCOUNT_PCENT", "v_NewSalesReportView"."C_INVOICE_CREDIT", "v_NewSalesReportView"."C_QUANTITY" FROM "sysdba"."v_NewSalesReportView" "v_NewSalesReportView" WHERE "v_NewSalesReportView"."ACCOUNT_NUMBER"='ASTO08'
Every time after the report is run after it generates the following SQL instead..
SELECT "v_NewSalesReportView"."C_THEIR_REFERENCE", "v_NewSalesReportView"."ACCOUNT", "v_NewSalesReportView"."ACCOUNT_NUMBER", "v_NewSalesReportView"."ANALYSIS1", "v_NewSalesReportView"."C_ITEM_NUMBER", "v_NewSalesReportView"."C_TRANSACTION_DATE", "v_NewSalesReportView"."C_ORDER_NUMBER", "v_NewSalesReportView"."C_INVOICE_NUM_TEXT", "v_NewSalesReportView"."C_ALTERNATE_PART", "v_NewSalesReportView"."C_EXCHANGE_RATE", "v_NewSalesReportView"."C_PRICE", "v_NewSalesReportView"."C_ITEM_DISCOUNT_PCENT", "v_NewSalesReportView"."C_INVOICE_CREDIT", "v_NewSalesReportView"."C_QUANTITY" FROM "sysdba"."v_NewSalesReportView" "v_NewSalesReportView" WHERE "v_NewSalesReportView"."C_INVOICE_NUM_TEXT"<>'' AND ("v_NewSalesReportView"."C_TRANSACTION_DATE">=CONV
ERT(DATETIME, '2007-09-29 00:00:00', 120) AND "v_NewSalesReportView"."C_TRANSACTION_DATE"<CONVER T(DATETIME, '2009-09-29 00:00:00', 120))
It will execute the second query every time until we reload the client using ctrl + f5, where it will run the first query once again, and then the second query every time after.
Has anyone ever seen behaviour like this before? Is there something stupid I'm missing?
Thanks
09-28-2009 07:13 AM - last edited on 09-28-2009 07:20 AM
Hi Andrew,
Do you have the 'Save Data with Report' checked within the report itself under the File menu? I know that can cause some oddities when running reports.
09-28-2009 07:22 AM
The save data with report option is unchecked.
10-01-2009 06:53 AM
In your code that calls the report to you discard saved data? Like below...
'Get RDC Object
set Report = Application.BasicFunctions.GetCrystalReport(strRep
Report.DiscardSavedData
11-09-2009 09:13 AM
06-15-2010 11:08 AM
I'm seeing a similar issue, where every time the RDC object is called after the report plugin has been loaded, it executes the SQL from the report without applying the filter for the record, in the example the "ACCOUNT_NUMBER"='ASTO08'
So on every subsequent run after the first it is pulling excess row from the database. And the DiscardSavedData does not do the trick.
If you find the solution, please share
06-16-2010 02:00 AM
07-06-2010 09:58 AM
Turns out that the problem is the temp files that are created when the report is first run. The second time you run the temp files cause the report to run using a query without the selection formula hence getting too much data. When you reload (ctrl-f5) the temp files are purge and the next run is fine. I sure it was designed toward efficiency, but ends up being an "undocumented feature"
My business partner worked out a way around it when displaying to the crystal viewer, but we have a need to push reports directly to PDF from buttons on the mainview, and we haven't got that worked out yet.
Writing a new crystal view would be very inconvenient due to deployment issues.
Thanks,
Todd