Recent

Author Topic: DBGrid total  (Read 5613 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
DBGrid total
« on: March 21, 2016, 09:44:51 pm »
Hello guys, who tells me how to get a line to the bottom of dbgrig I displays the totals for a particular column?

Thank you
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: DBGrid total
« Reply #1 on: March 21, 2016, 10:45:59 pm »
You can't do this with standard DBGrid and I don't know any third party components which can do this (other then just putting a label below the DBGrid with the total).

But can't you change your SQL-statement to include a summary-record? In some SQL-variants you can use ROLLUP. If your DB doesn't support that you could use UNION ALL and do a SELECT with SUM in the second part.

dogriz

  • Full Member
  • ***
  • Posts: 126
Re: DBGrid total
« Reply #2 on: March 22, 2016, 07:44:11 am »
There is a very good DBGrid component for that and many other things: http://www.ehlib.com/
But, sadly, it is not free :(
FPC 3.2.2
Lazarus 2.2.4
Debian x86_64, arm

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: DBGrid total
« Reply #3 on: March 22, 2016, 08:25:48 am »

JZS

  • Full Member
  • ***
  • Posts: 194
Re: DBGrid total
« Reply #4 on: March 22, 2016, 08:43:16 am »
RX is the one you are looking for.
I use recent stable release

dogriz

  • Full Member
  • ***
  • Posts: 126
Re: DBGrid total
« Reply #5 on: March 22, 2016, 12:28:03 pm »
I didn't know about RX. Very nice set of components.
FPC 3.2.2
Lazarus 2.2.4
Debian x86_64, arm

 

TinyPortal © 2005-2018