Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Dynamic Reports

Muthukrishnan edited this page Mar 14, 2016 · 1 revision

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.

How to create dynamic queries

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>

2015-01-31_0514

 

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
Clone this wiki locally