Android Question B4XTable, is Add a Summary is possible?

incendio

Well-Known Member
Licensed User
Longtime User
Hi guys,

New to B4XTable, have a columns, some of those columns is a number type and want to have a summary at the end of table.

Is it possible to do this?

Use this code to add total at last row
B4X:
    Tbl.sql1.ExecNonQuery2("INSERT INTO data VALUES(?,?,?)" , Array As Object("", "TOTAL", 10000))
    Tbl.ClearDataView

It worked OK, but only if users do not sort any columns.

Is it possible to make summary row always at the end of table?
 

aeric

Expert
Licensed User
Longtime User
It worked OK, but only if users do not sort any columns.
Then you have to make sure the row must appear at the bottom.
I may use a hidden column contains a sequence number.
Let say the data rows are sorted in ascending order, then the summary row must have a number as huge as possible such as 9,999,9999. If the column contain alpabetical values then it must start with Zxxxx or something to ensure it also appear as the last row.

My prefer way is to add some labels just below the B4XTable. I can also easily set the text formatting or text size as I like. It is very much easier.

1763958706802.png
 
Upvote 0

incendio

Well-Known Member
Licensed User
Longtime User
Would like to add labels too, but there are some difficulties
1. In some cases, there are many columns that have summary, how to align these labels to the corresponding columns?

2. Mostly, in my app, table is horizontal scrollable, so labels also must be synchronized scroll too, which mean another complexity.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
If you must make the summary row as part of the B4XTable, then you need to handle the special cases.
As I mentioned, make use of hidden column (set column to invisible).
Handle this row so it will not get sorted and excluded from the summary calculation.

If it is too complicated to use the B4XTable as it is, then you have to modify the B4XTable class to suit your requirements.
 
Upvote 0

incendio

Well-Known Member
Licensed User
Longtime User
Even if after modifications it can handle summary, but still sometimes I need Sub Total and to modify B4xtable to handle Sub Total, if it's even possible, is beyond my skill.

A pity, b4xtable is easy to use, but for me, ultimate list view is more suitable.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Yes, B4XTable is very straightforward. Just need to understand it is build with XCustomListView and in-memory SQLite. It is suitable for cross-platform development.
I am not familiar with UltimateListView which is more close to what you are looking for.
 
Upvote 0
Top