Technote

(FAQ)
Implementing dynamic queries for operational reports based on a user's role
How do you implement dynamic queries for operational reports in the WebSphere Commerce Accelerator based on a user's role?


Answer

There are three possible solutions.


<Report  reportName="ReviewCustomerContactPointsReportMonthlyTime" online="true"  >
<comment></comment>
<SQLvalue>
select
CASE WHEN {member_id}=3000 THEN orders.totalproduct
WHEN {member_id}=3001
THEN orders.totalproduct1 ELSE 0.0 END
orders.orders_id,
                CASE WHEN {member_id}=3000 THEN orders.totalshipping
WHEN {member_id}=3001
THEN orders.totalshipping1 ELSE 0.0 END
orders.orders_id,
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  **Similarly one case statement for every field that you want to fetch **
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
from orders
where orders.storeent_id = {storeent_id}
and orders.status in ('S', 'D')
and orders.lastupdate &gt;=
$DB_TIMESTAMP_FUNC({StartDate})$
and orders.lastupdate &lt;=
$DB_TIMESTAMP_FUNC({EndDate})$
order by orders.lastupdate
</SQLvalue>


The fields returned, for instance orders.totalproduct and orders.totalproduct1 should be of the same data type. Each field requires a separate case statement.

 

Document Information

Current web document: http://www.ibm.com/support/docview.wss?uid=swg21292816