-
Notifications
You must be signed in to change notification settings - Fork 2
Dynamic Reports
When you are trying to create report for a particular employee using his employee id then the query has to have that id as one of the conditions in your SQL. You can get this id value from session or parameter. To be able to create such reports you can use the dynamic query feature in Caxpy.
Watch the below video to see how it can be done.
A sample query would look like
select product_family,product_category,sum(store_sales) as store_sales,sum(store_cost) as store_cost from agg_g_ms_pcat_sales_fact_1997 where product_family='<family>' group by product_family,product_category
You can see how the parameter has been put in the query using brackets. <family>
The embed code generated for the above report would look like
<div class='caxpy-report' id="1422660242953" data-params=[{"name":"family","value":"Drink"}]' ></div>
If you are trying to embed this in a jsp file then you can provide parameters from your request attribute as show below.
<div class='caxpy-report' id="1422660242953" data-params='[{"name":"family","value":"<%=request.getParameter("family")%>"}]' ></div>
Important notes:
- Provide single quotes for string parameters ex: select id,name from footable where name='<name>'
- Parameter names are case sensitive. If you have provided <Family> in query then when adding parameter you must provide the name as Family