How can i add a footer with totals in dbgrid

Posted on 2008-11-17
Last Modified: 2013-11-23

I need a footer in dbgrid where I want to pace total for a column.

Thanks !
Question by:radugheorghies
    LVL 21

    Expert Comment


    read this link and it should help...also I will be available to help...
    LVL 21

    Expert Comment

    oops..that was vb...
    LVL 21

    Expert Comment

    just noticed you're using adelphi...
    LVL 36

    Accepted Solution

    there are some ways of doing this:

    use a component like TMS grid or DevExpress grid which have this option built in

    depending on your query and probably database
    add a query with union with totalized fields
    if you query is :
    select a,b,c from table

    then it would be
    select '1' sorting, a,b,c from table
    select '2' sorting, a, b, sum(c) c from table
    group by a,b
    order by 1

    to keep the row on the bottom the sorting is added

    or add a panel and a caption below the grid with the totalized field


    Author Closing Comment

    Thanks for your information. I understand that is no other way to do this. I will choose the pannel solution.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
    Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now