Subject Re: how to calculate 2 records of the same column of a grid?
From Leslie Shewchuk <l.shewchuk@gmail.com>
Date Tue, 12 Jan 2021 17:17:19 -0500
Newsgroups dbase.getting-started

Hello Dirk,

I don't think you will be able to it exactly like excel (ie Cell G15 =Sum(G2..G12) )  but you can display your total in an Entryfield or Text outside of the grid.

What I do is open 2 queries for the lines (Form.Line1 and form.line2) that are the same.  They can even both be linked to a Heading table (Invoice, or Customer).

Form.Line1 becomes the datesource to the Grid.  Form.line2 is not the datasource to anything, which will allow  you to navigate it without any controls being updated.

The using form.line1.rowset.onsave or Form.line1.rowset.onNavigate events, I can then scan through form.line2.rowset and recalculate my totals and then display them on the form.

I'll see if I can come up with a example.

Les Shewchuk

Dirk Wrote:

> Goodday,
> i am trying to calculate 2 records of the same  column as excel, make a
> sum in a calculated fields, by clicking on the grid cell
>
> means want to know the consume of solar electricty in a certain period
>
> i can of course use 2 colums , 2  fields : 1 begin and 1 end
>
> but begin of column 1 day x, should be end of column end day - 15
>
> day is date field i put the info into
>
> so, to avoid a column i trying to find out a way as excel
>
> thanks for a helping hand
>
> best regards
>
> Dirk