2

I have a datawindow that has 2 groups (Company and Department). I need to show the overall total amount for the company even if the user has filtered by Department.
Data Scenario

Company   Department Role       EmpCount
ABC       X          Managers       2
ABC       X          Employees     33
ABC       Y          Managers       1
ABC       Y          Employees      9

I need the group totals for the Department Group (Group 2) to include only the count for that department (sum(EmpCount for group 2)) ... which works.
I need the group totals for the Company Group (Group 1) to include the count for ALL departments (sum(EmpCount for group 1)) or (sum(EmpCount for all)) whilch works initially.

But, when the user filters the datawindow to only show the rows for the "X" department, the group total for the Company group now only reflects the data for the one department (35) but I need it to always show for ALL (45).
The datawindow is also editable so the value must be a computed field, not a retrieved value.

I have tried using SetDetailHeight to 'hide' the rows for other departments, which works for keeping the Company group totals correct, but it still shows the trailer for the departments that are filtered out.

Stephen J
  • 21
  • 3

2 Answers2

0

Instead of use filter function on the datawindow you can eventually use the modify function on the height property on group you want to hide. In this case your compute sum( ...for all) will be 45.

0

Determining a datawindow count on filtered data with no apparent UI impact. This should work fine, but if for some reason you don't want to manipulate the visible datawindow you could create a quick datastore, assign the datawindow dataobject, and copy rows using RowsCopy, than manipulate data on the datastore. It sounds like a lot but unless you have tens of thousands to hundreds of thousands of rows there should't be much of a performance penalty. If I recall PB has a more efficient way than RowsCopy - I think you can just assign data of one to data of another or something like that - sorry I don't have my PB help close by.

  1. Store datawindow filter to a local string for later use.
  2. Turn off the datawindow redraw by dw_1.SetRedraw(false)
  3. Clear filters using SetFilter and Filter functions
  4. Get any counts that you need
  5. Restore your original filter using SetFilter and Filter
  6. Turn the datawindow redraw back on by dw_1.SetRedraw(true)
Rich Bianco
  • 4,141
  • 3
  • 29
  • 48