Update the sum of pieces on table filter

I’m working with a Table componant that includes a Pieces column, and I want to display the total sum of that column at the top of the table.

Right now, I’m using a table filter‑change script to calculate the sum, but the value doesn’t always update correctly — sometimes it doesn’t refresh, and other times there’s a race condition because the script fires continuously.

There are several filters applied to my Power Table, including a multi‑select dropdown and a “Show All” toggle.

Is there an alternative way to calculate the sum of the Pieces column without relying on the Power Table’s filter‑change script?

I would do an expression binding checking the len of props.filter.results.data

len({../Table.props.filter.results.data})

Then a script transform that sums the filtered result data if the value of the expression is >0

Else do the sum on the table.data

This way the expression will fire when the filtered data size changes

Are the filters external to the table? Are you trying to show the total in an extra row?
Describe your data flow or b I ndings in more detail.

here is table, top of the view I am displaying SQDT, PCS and total records, which are not updating correctly or sometimes having race condition if we filter from table filter

the filter dropdown is bound to data using an SQL query.

The SQFT and PCS labels have transformation scripts that calculate their respective values. Additionally, on every table filter change, there is logic in place to recalculate SQFT, PCS, and Total Records based on the currently filtered result set.

Do you have props.filter.results.enabled set to true ? If not, turn it on.

Then, your summary labels at the top can uses the table's props.filter.results.data as their binding source. That should eliminate race conditions.

2 Likes

Any alternative for table filter change script?

No, the answer is to not use that event. Use the result data delivered from the front end (browser) specifically for this kind of usage.