I have a table data in my Appsmith application and I need to calculate the total of specific column in a label
Hello, if you are using server-side pagination, you can write a query to do this. If you are using client side pagination, you can use the lodash sumBy function to sum the data
{{ _.sumBy(Table1.tableData, (row) => row.columnName) }}
Thanks Nikhil for your reply
Really I don’t know more about pagination
I only connected a SQL server database to my application and show its data inside a table as shown on the attached photo
I need to sum the value for Cash and the value for the VISA on the labels under the table
I hope you can help me with this
This should work
{{ _.sumBy(Table1.tableData, (row) => row.Visa) }}
Can you share a screenshot of the query result that you use to populate the Table widget? Is the name of the field returned by your query exactly “Visa
”?
i want page wise totals pls suggest formula
Thank u for ur quick response
i have a table widget in that i have multiple pages
, in that table have Amount Column, i want to show the Amount Total page wise(displaying values total only), when i change the page it will update automatically , but now it is showing total pages summery only
Alright.
Are you using server-side pagination for your table?
no i am using client side pagination
Alright. Can you try this and see if it works for you?
{{_.sumBy(Table1.tableData.slice(Table1.pageOffset, Table1.pageOffset + Table1.pageSize), (row) => row.amount)}}
Thank u it’s worked , and also when apply sorting or Filters from client side can I get sum dynamically ?
Hey! What do you mean by dynamic?
With the snippet that Olawale gave you, it’s should be dynamic already from what I understand. If I am missing something, can you share a loom video and point out the issue.