Bug 1282861

Summary: [GSS](6.2.z) Dashbuilder - Filter properties selected on a filter form are not used in the filtering if data provider is based on "SQL query"
Product: [Retired] JBoss BPMS Platform 6 Reporter: Oscar Molina <omolinab>
Component: BAMAssignee: David Gutierrez <dgutierr>
Status: CLOSED EOL QA Contact: Gui Jospin <gjospin>
Severity: urgent Docs Contact:
Priority: high    
Version: 6.2.0CC: alazarot, kverlaen, lpetrovi
Target Milestone: CR1   
Target Release: 6.2.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1295497 (view as bug list) Environment:
Last Closed: 2020-03-27 20:04:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1288023, 1295497    

Description Oscar Molina 2015-11-17 16:23:38 UTC
Description of problem:

'Filter & Drill-down' panel allows for the quick definition of dynamic forms which allow us to navigate throughout the data displayed by the dashboard.

Some filter properties selected on a filter form are not used in the filtering if data provider is based on "SQL query" in Dashbuilder for BPMS 6.1.

We have built a start page with some basic info. There is a filter panel for 2 properties. Both of the properties are sent to a detailed page with more information using conditional queries. On the detail screen, we filter the data based on these two properties, with a SQL query as follows:

select ....
where ({sql_condition, optional, name, name1}
and {sql_condition, optional, date, date1})

But the detail screen is never filtering automatically on both values. If only one of them is selected, filtering is OK. If both properties are selected, only one of them is used for filtering. Expected is that both properties are filtered on.

If you access to the console.jsp as "root" (http://localhost:8080/dashbuilder/system/console.jsp) and go to the "System > Thread Profiler", you can see that the query doesn't show one of the filtering properties when the filter is executed.

Steps to Reproduce:

1. Create the following test table in the local database. It doesn't matter the database. We have tested with Postgresql.

CREATE TABLE mytest (
   dbid bigint PRIMARY KEY,
   name varchar (512),
   date TIMESTAMP
);

2. Insert some registers as follow:

INSERT INTO mytest (dbid,name,date) VALUES (nextval('hiberante_sequence'),'John Smith','2015-10-01 12:00');
INSERT INTO mytest (dbid,name,date) VALUES (nextval('hibernate_sequence'),'John Smith','2015-11-03 12:00');
INSERT INTO mytest (dbid,name,date) VALUES (nextval('hibernate_sequence'),'John Smith','2015-11-10 12:00');
INSERT INTO mytest (dbid,name,date) VALUES (nextval('hibernate_sequence'),'Kelly Doe','2015-10-15 12:00');
INSERT INTO mytest (dbid,name,date) VALUES (nextval('hibernate_sequence'),'Kelly Doe','2015-16-16 12:00');

3. Go to 'Dashboards -> Business Dashboards -> Administration -> Data providers'

4. Create the following data providers:

* DP1 * -> type: SQL Query 
select date as "date(1)", name as "name(1)" from mytest
order by date asc;

* DP2 * -> type: SQL Query 
select dbid, name, date from mytest
where {sql_condition, optional, mytest.name, name(1)}
AND {sql_condition, required, mytest.date, date(1)}
ORDER BY date asc;

5. Create 2 pages: "testpage" and "testpage2".

6. In the "testpage":
 - Add a "Key performance indicator" panel with data provider "DP1"
 - Add a "Filter & Drill-down" panel with "date" and "name" properties visible which have configured "Drill-down" to "testpage2".

7. In the "testpage2":
 - Add a "Key performance indicator" panel with data provider "DP2"
 - Add a "Filter & Drill-down" panel with "date" and "name" properties visible.

Actual results:

If only one of them is selected, filtering is OK. If both properties are selected, only one of them is used for filtering.

Expected results:

If one of them or both are selected, filtering should work.

Comment 2 David Gutierrez 2016-01-08 09:13:03 UTC
Fix + test done.

PRs pushed:

(master) https://github.com/droolsjbpm/dashboard-builder/pull/36
(6.3.x) https://github.com/droolsjbpm/dashboard-builder/pull/37

Comment 3 Kris Verlaenen 2016-01-10 21:22:42 UTC
PRs were merged.

Comment 4 Jan Hrcek 2016-01-18 09:22:11 UTC
Verified the scenario described with BPM Suite 6.2.1 CR1. Filtering is working as expected, taking all selected filters into consideration.