Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I make this param dinamic inside "show sql query"?

Status
Not open for further replies.

Fursten

Programmer
Dec 27, 2000
403
0
0
PT
Hi,

In my subreport I want to be able to change the sql query (in database\show sql query) so that it evaluate dinamically a parameter that I defined in the subreport (and wich I linked to a field in the main report).

However, if I make something like this:

SELECT
field1,
field2
FROM
databaseTable
WHERE
field1 = ?codParam

I can see that crystal doesn´t make ?codPAram = number gived
In fact, it leaves ?codParam as is (like if it was a string) and then, of course, give me an error.

How can I make this param dinamic inside "show sql query"?

Thank you

Sergio Oliveira

 
If you add a rule in the select expert using the parameter, Crystal will add it to the SQL automatically. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Hi, I have a question which is some wahat related to this. The disadvantage of having the rule in "Select Expert" is that it will retrieve all the records from the database, and do the selection only while sending the data on the screen which will affect the performance. Is there a way to put the Record Selection Criteria within the "Where clause" in "SHOW SQL QUERY" rather than putting it in the "Record Selection" screen. Any help on this regard would be greatly appreciated.
 
yep, that is way I want to put in "show sql query" too! I realized that, dispite it is possible to send that selection criteria to the database, crystal doesn´t do that if we use select expert (crystal will evaluate if it can or not be send... my critiria could be send... but crystal doesn´t do it :( )

That´s why I would like to include dinamic criteria in "show sql query"

Any ideias?

Sérgio Oliveira
 
Crystal can convert some parameters rules to SQL, but not all. Depends on the data type of the parameter and how it is used in the selection formula. However, I don't think you can edit this directly and have CR recognize it.

You could create the parameter in a stored procedure in the database and report off of that. Or you could create the SQL statement in the SQL designer (with a parameter) and report off of the QRY file.

CR is supposed to incorporate more SQL flexibility into CRv9, when it is finally released. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top