Friday, March 30, 2012

Passing of parameter

Need help for the passing of parameter in CR9.

How to pass the "record_id" from main report to the sql command of subreport. To clarify, i add a sql command in database expert in fmy subreport. This is my query....

For the main report..

Select record_id, distributor_name... from distributor

In the sql command of my subreport....

Select record_id, distributor_name, customer_id, sum(sales) as amount where record_id =2 group by record_id, distributor_name, customer_id
order by amount desc limit 20.

All i want to do is how to pass the record_id from the main report into the sql command of my subreport to look like this....

Select record_id, distributor_name, customer_id, sum(sales) as amount where record_id =("record_id from main_report") group by record_id, distributor_name, customer_id
order by amount desc limit 20.

My goal is how to view the top 20 accounts per distributor

Thanx a lot!!!1. Make main report
2. make sub report with same parameters.
3. In Design mode of main report, edit->subreport links.
Select main report parameter and link it to subreport parameter.

No comments:

Post a Comment