This topic is locked

Set Parameter for Report

5/6/2008 10:52:07 AM
ASPRunnerPro General questions
Stu author

The "Before SQL Query" event has the following parameters:-
BeforeQueryReport(strSQL,strWhereClause,strOrderBy)
There is the possibility to pass a Session Variable between pages. So, is it possible to pass the Key from a List view into a Session Variable so that you can alter the strWhereClause to make a Report only show the data for that Key?
If so, how would I code it?

J
Jane 5/7/2008

Hi,
Session variables are available in all events.

Just create and fill Session variable in the event on the list or view pages and then use it on the another pages.

Stu author 5/7/2008

Hi,

Session variables are available in all events.

Just create and fill Session variable in the event on the list or view pages and then use it on the another pages.



Jane,
I suspected that. However I don't know what syntax I would use to re-construct a WHERE statement for that Report page based on the session variable.
I would 'cheat' a little by copying the SQL string from the original table as a staring point. That gives me a "SELECT x from y". What code do I write so that I add a WHERE statement that the Report page uses?
Thanks,
Stu

J
Jane 5/8/2008

Stu,
here is a sample:

strWhereClause = whereAdd(strWhereClause,"fieldname=" & Session("Field"))


Use this code in the Report page: Before SQL query event on the Events tab.

Stu author 5/12/2008

Stu,

here is a sample:
Use this code in the Report page: Before SQL query event on the Events tab.


Thanks for that. First time back since posing the question. Will give it a try and report back
Regards,
Stu