optional parameter
I'm attempting to use an optional parameter to build my report query. My base query is as follows:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
select
o.orders_id,
o.orders_number,
o.date_purchased,
o.customers_name,
o.customers_street_address,
o.customers_city,
o.customers_state,
o.customers_postcode,
o.customers_telephone,
o.customers_email_address,
op.products_id,
op.products_name,
opa.products_options_values_id,
opa.products_options_values,
ot.value
from orders o
inner join orders_products op on o.orders_id = op.orders_id
left join orders_products_attributes opa on op.orders_products_id = opa.orders_products_id
inner join orders_total ot on o.orders_id = ot.orders_id
where o.orders_status = 5
and ot.class = 'ot_total'
and o.date_purchased >= ?
and o.date_purchased <= ?
</pre>
<br />
Then, on the data set's 'beforeOpen' script, i have this:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if (params["productIdParam"] != null && params["productIdParam"] != 0)
{
this.queryText += " and op.products_id = " + params["productIdParam"];
this.queryText += " order by opa.products_options_values_id, o.date_purchased;";
}
else
{
this.queryText += " order by op.products_id, opa.products_options_values_id, o.date_purchased;";
}
</pre>
<br />
When I run this query, if I do not supply a product id, I get nothing back; contrarily, if I do enter a product id, the report runs just as expected. I cannot see anything that's wrong with what I've done, but obviously, something is. I've attached my report design file. Any help on this would be greatly appreciated, thanks.<br />
<br />
Oh, also, I cannot get logging to work. I am using BIRT Report Designer (i.e. stand-alone - I think this is what the RCP refers to?), version 2.6.1. My goal would be to enable SQL logging so that I can see what BIRT is using to query the database; I would think this would help me debug these types of issues on my own. Again, any help with this would be great. Lastly, I have removed database connection details from the uploaded report, so just be aware of that.