Link to home
Start Free TrialLog in
Avatar of Trotters
Trotters

asked on

SQLQueryString - where to find

Hi all

Have downloaded a trial copy of CR10 to use within .NET. I have a page which reads a session based xml document containing the report file and any parameters to pass in. One of the reports that will be loaded in the viewer is causing a bit of a headache. It takes 13 parameters, but needs to ignore any blanks and link in an additional table when one is set to a certain value (for a major speed boost). This can't be done 'normally' and the report takes a ridiculous amount of time to run. I have used a dataset in the past, which works very quickly as I can create a very efficient SQL statement based on the parameters in the xml. Unfortunately, I have just been informed that  our customers all have different criteria for what they want displayed (even though it is invoked from the same page). So I can no longer use a dataset. The plan now is to create the customers reports with no selection criteria and then manually change the where clause of the sql (all the query fields are in the same master table) at runtime. I have no problem with doing this, but I can't find the report class which contains the SQLQueryString - in the help file it gives no reference to the dll, namespace and class where the 'Report Object' can be found (their developer help is a pile of crap tbh). I've been using ReportDocument but it doesn't have this property anywhere. Can anyone advise me which class I should be using and what dll I need to reference in order to access it?

Thanks in advance.
Avatar of frodoman
frodoman
Flag of United States of America image

Why not just filter your dataset at runtime and pass it (or a subset of it) to the report as you've been doing?
Avatar of Trotters
Trotters

ASKER

That would require code changes and a re-build every time it is deployed to a new customer or an existing client required output change. Reports can be easily updated, which is why I want to take this approach. It would be easy if the documentation was up to scratch.
In that case I believe you want the recordselectionformula:

   Report.RecordSelectionFormula = "{Orders.ID} = 1"

This isn't a direct change of the SQL, but the record selection is converted into the SQL's "where" clause so it should work for you need.

Thanks for trying, but I do need to edit the SQL. I have to reference another lookup table when a certain parameter is set, so the record selection cannot help with that. If it wasn't for that then yes I could just change the selection criteria. I just need to find the 'Report Object' class which this extract of the developer help is pointing at:

"A report corresponds to a print job in the Crystal Report Engine. When the report object is destroyed, or goes out of focus, it closes the print job. It holds on to Application Object. When a Report Object gets destroyed, it releases the application.

Access to the Report Object is dependent on the object variable you create. If the object variable goes out of scope, you will lose access to the Report Object and, therefore, the report. You may want to declare your Report Object variable as Global."
ASKER CERTIFIED SOLUTION
Avatar of frodoman
frodoman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Cheers, since it has been present in reports since at least version 8.5 then as you say it's probably a limitation of their component. 'Advanced Developer Edition' my arse.