PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Create View with sum
Create View with sum
Iniciado por guest, 26,nov. 2014 19:56 - 3 respuestas
Publicado el 26,noviembre 2014 - 19: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]
Publicado el 26,noviembre 2014 - 20:46
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 (<a class="ExternalLink" rel="nofollow" target="_blank" href="http://doc.windev.com/en-US/?1013305">http://doc.windev.com/en-US/&hellip;</a>) 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
Publicado el 27,noviembre 2014 - 09:39
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
Publicado el 29,noviembre 2014 - 09:44
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.