Create View with sum

Startbeitrag von Sammy Broeders am 26.11.2014 18:56

Hello all,

I have in my project a data file as in the attach, now i want to make a view where i can see from each "Kenteken" one line with the total of "Bedrag1"
Just like this:

KENTEKEN DEBITEURNO BEDRAG1
XT-86-TK 10824 283,25
XT-JZ-27 10823 700,76
Etc.

Thanks!
[attachment 1255 Knipsel.JPG]

Antworten:

Hi Sammy,

If this is an SL request behind the table you can simply GROUP BY Kenteken and SUM the Bedrag1 field. This will give you the desired result.

Otherwise, you will have to compute the data manually. There are many different methods to do this which are all easy. It depends of what you want to do.

- You can use a Break in the table (http://doc.windev.com/en-US/?1013305) and display to sum in it. So you still have access to the details.

- If the data is loaded manually, you can load summed data by searching if a line with the desired Kenteken exist (else add id), then add to the sum.

- You can use a simple associative array to add the values, or a standard array with structure or class to do the same: seek if exist, add/update. Then load the table or link with databinding.

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 26.11.2014 19:46
Hi Sammy,

Do you want to anchor the table as well? If so, at least in version 18 < there is an odd bug in the table when adding a break to a table. it draws the sum in the rows above where you would expect it over the normal row. There is no way to get rid of it then to remove teh anchor in the table. If no anchor the bug is gone. ( thought you would like to know )

Then
The easyest way is to add a break to the table. No programming to do just use the 7 tabs.

regards

Allard

von Allard - am 27.11.2014 08:39
Hi
1. Maybe you can try with SQL Query "SELECT Debiteurno, Kenteken FROM MyFile,...."
2. You can create view and read records (FOR EACH) , SUM on each same key and then TableAddLine() when key is changed.

von ICI - am 29.11.2014 08:44
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.