Topic: Copying tGrid footer values...

Hi Guys,


Objective is to move some tGrid footer values to currency fields so that I can try to do new calculations.


Please see the attached sample project:

Post's attachments

Attachment icon Expenses tGridFooter.zip 10.41 kb, 374 downloads since 2016-12-07 

Adam
God... please help me become the person my dog thinks I am.

Re: Copying tGrid footer values...

Hello.


procedure Form1_tgSearchExpenses_OnChange (Sender: string);
begin
    Form1.edMnetTotal.Value := Form1.tgSearchExpenses.Columns[5].Footer.FormulaValue;
    Form1.edMtaxTotal.Value := Form1.tgSearchExpenses.Columns[6].Footer.FormulaValue;
end;
Dmitry.

Re: Copying tGrid footer values...

Hi Dmitry,


Thank you very much......

Adam
God... please help me become the person my dog thinks I am.

Re: Copying tGrid footer values...

This time I wanted to copy tGrid footer value from one form into another form edit field with it's decimals and thousands separator.


Source frmSaleInv tGrid, target frmSaleTransHist / edSaleInvTotal field. I tried the following but didn't work:

procedure frmSaleTransHist_OnShow (Sender: string);

    begin
    frmSaleTransHist.edSaleTransInvTotal.Value := frmSaleInv.tgSaleInv.Columns[9].Footer.FormulaValue;

    end;

Please see the attached sample project:

Post's attachments

Attachment icon FooterValue.zip 34.51 kb, 371 downloads since 2017-01-23 

Adam
God... please help me become the person my dog thinks I am.

Re: Copying tGrid footer values...

AD1408
I checked your project, but in frmSaleInv.tgSaleInv there is no column with number 9.


Also on form frmSaleTransHist I can't find component with name edSaleTransInvTotal

Dmitry.

6 (edited by AD1408 2017-01-23 17:46:48)

Re: Copying tGrid footer values...

Thanks Dmitry,


I tried following but get "List index out of bounds (1)" warning

procedure frmSaleTransHist_OnShow (Sender: string);
  begin
    frmSaleTransHist.edSaleTransInvTotal.Value := Form1.tgSearchSaleInv.Columns[9].Footer.FormulaValue;
  end;

Actually, I wanted copy form1/tgSearchSaleInv footer value.
Corrected frmSaleTransHist component name to edSaleTransInvTotal

Adam
God... please help me become the person my dog thinks I am.

7 (edited by AD1408 2017-01-24 15:30:45)

Re: Copying tGrid footer values...

AD1408 wrote:

Thanks Dmitry,


I tried following but get "List index out of bounds (1)" warning

procedure frmSaleTransHist_OnShow (Sender: string);
  begin
    frmSaleTransHist.edSaleTransInvTotal.Value := Form1.tgSearchSaleInv.Columns[9].Footer.FormulaValue;
  end;

???

Edit:
What I'm trying to do is copy tGrid footer values to another form and do calculations there
Please see the Updated sample project 2 with error and calc attached:

Post's attachments

Attachment icon FooterValue 2.zip 35.48 kb, 357 downloads since 2017-01-24 

Adam
God... please help me become the person my dog thinks I am.

Re: Copying tGrid footer values...

AD1408
You have not right params in the procedure OnShow, procedure with right params:

procedure frmSaleTransHist_OnShow (Sender: string; Action: string);
begin
   frmSaleTransHist.edSaleTransInvTotal.Value := Form1.tgSearchSaleInv.Columns[9].Footer.FormulaValue;
end;

You forgot "Action: string" it's cause the error "List index out of bounds (1)"

Dmitry.

Re: Copying tGrid footer values...

Thank you so much Dmitry.....................

Adam
God... please help me become the person my dog thinks I am.