First, I'm gonna describe the structure:
The sub_department depends (cascades) with department. A combination of two results to a unique product.
In PRD, I have two filters, one for department (dept_filter) and one for sub_department (sdept_filter) The values inside sub_department depends on the value(s) selected from department. The cascading part works fine. However, in PRD, selecting an item inside a multi-list value also selects all items that shares the same "index" as that of the selected item.
Given this scenario:
I just want to select Product 1 (department 1, sub_department 1), Product 5 (2, 2) and Product 9 (3, 3). I have this at the where clause of my report query:
where department IN (dept_filter) and sub_department IN (sdept_filter). At the first glance, it does work fine. You might think that it would only select Products 1, 5 and 9. Nope. It would select all items. The (dept_filter) contains (1,2,3) while (sdept_filter) also contains (1,2,3) which results to all items. It is because when you select the sub_department 1 from department 1, it would automatically select sub_department 1 from departments 2 and 3, since they all share the same sub_department ID.
Here's the question: What could be the solution in order to achieve the desired output, rather than resulting to the scenario stated above? Thanks!
product_id | department | sub_department |
1 | 1 | 1 |
2 | 1 | 2 |
3 | 1 | 3 |
4 | 2 | 1 |
5 | 2 | 2 |
6 | 2 | 3 |
7 | 3 | 1 |
8 | 3 | 2 |
9 | 3 | 3 |
The sub_department depends (cascades) with department. A combination of two results to a unique product.
In PRD, I have two filters, one for department (dept_filter) and one for sub_department (sdept_filter) The values inside sub_department depends on the value(s) selected from department. The cascading part works fine. However, in PRD, selecting an item inside a multi-list value also selects all items that shares the same "index" as that of the selected item.
Given this scenario:
I just want to select Product 1 (department 1, sub_department 1), Product 5 (2, 2) and Product 9 (3, 3). I have this at the where clause of my report query:
where department IN (dept_filter) and sub_department IN (sdept_filter). At the first glance, it does work fine. You might think that it would only select Products 1, 5 and 9. Nope. It would select all items. The (dept_filter) contains (1,2,3) while (sdept_filter) also contains (1,2,3) which results to all items. It is because when you select the sub_department 1 from department 1, it would automatically select sub_department 1 from departments 2 and 3, since they all share the same sub_department ID.
Here's the question: What could be the solution in order to achieve the desired output, rather than resulting to the scenario stated above? Thanks!