1 (edited by manixs2013 2019-08-23 13:20:25)

Topic: SQL Statement in Table Grid

Hello MVD.

I have encountered in my prject.  I have a table grid and i used the button using SQL QUERY.. Now my problem is how to set an alignment in the column and also having putting a counter and total sum on the footer.

Another, when i exported it in the excel using the button the columns beyond are being set to text in excel format rather than general.. You need set it first in the general format so that you can autosum the column.

Please

Thanks!

Re: SQL Statement in Table Grid

Please send your project without the .exe.

As for the export to excel, it actually is a CSV export which means that you have to format whatever comes out by yourself. CSV is a standard and can only export as text.

Re: SQL Statement in Table Grid

Hello.


You can set alignment and enable footer using script

procedure Form1_TableGrid1_OnChange (Sender: string);
begin
     Form1.TableGrid1.Columns[0].Alignment := taRightJustify; 
     Form1.TableGrid1.Columns[1].Alignment := taCenter; 
     Form1.TableGrid1.Columns[2].Alignment := taLeftJustify; 

     Form1.TableGrid1.Columns[0].Footer.FormulaKind := fkSum;
     Form1.TableGrid1.CalculateFooter;
end;


begin
    Form1.TableGrid1.Options := Form1.GridAbonent.Options + goFooter;
end.

To add a continuous numbering in the table component, which will be displayed in the query result, you can use the keyword "$ autoinc".
For example:

SELECT "$autoinc", somefield FROM table;
Dmitry.

Re: SQL Statement in Table Grid

manixs2013 wrote:

Another, when i exported it in the excel using the button the columns beyond are being set to text in excel format rather than general.. You need set it first in the general format so that you can autosum the column.

Please

Thanks!

Which version you use?

Dmitry.