Joget DX Preview Release Available for Download
Check out Joget DX, the next generation successor to Joget Workflow for faster, simpler digital transformation.
How can we create a final row that display aggregated values of the rest of the rows? This is especially important when it comes to reporting. One can design the form such that it serves as a report rather than a mean of data entry.
The final row is not a mere record row but serve as a summary of the record rows.
For this to happen, there are many ways to do it but we will focus on the dataset data loaded from its binder. First, we can inspect how data is constructed.
The element in question here is a basic grid, let's click into it.
The grid is using a pair of identical load and store binder (which makes sense most of the time so that data is stored and loaded from the same source). We can opt to use JDBC Binder as the load binder so that we can gain full control on how dataset is returned and constructed.
With the ability to define our own SQL query, we can then compose a query that will always return the last row as an aggregated values row.
And this is a sample result by running them on a command line interface.
However, it does not actually play out well with the JDBC Binder as it is only expecting one parameter in the query. Our union query has 2 parameters.
In order to overcome this, we can create a stored procedure in the database instead.
With the stored procedure to return the appropriate dataset that we need, we will just need to call it from the JDBC Binder.
This is the outcome.