Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 2 Jahren, 7 Monaten
Letzter Beitrag:
vor 2 Jahren, 7 Monaten
Beteiligte Autoren:
Erik Schwarz, Sammy Broeders, Ivan V., Al

Merge data from view or datafile

Startbeitrag von Sammy Broeders am 28.10.2015 17:40


In the picture below a view from a data file, how can i make a sum of the "Totaal tijd" from the same "Medewerker"?
So the second and the third row wil have both a "totaal tijd" of 3,00

[attachment 1747 Knipsel.JPG]



Hello Sammy

You can but it is not a perfect solution.
You can put breaks in the table - e.g. on Medewerker and you can generate sub totals for the break. The problem is that you have to put the subtotal value into a static and you can't link the static to a column so if the table is expanded or shrunk the static does not move with the column

It would work ok for you as you only have one column to add up.
Have a look at Table Break in the help


von Al - am 29.10.2015 06:19
Hello Sammy,

Looks like time Management :)

If you just want to Show the result in a table, Report, ... (not changing the data files), I do it this way:
Define a new table column (eg. tijdsum). Then make a programmed Loop through all table lines and do the Summation, writing the result in the new column.

Then you may hide the original (total tijd) or Show both of them or what you like to do.
And also, I prefer to Show the result only in one line (maybe the first or last for each mederworker) to prevent confusion.


von Erik Schwarz - am 29.10.2015 07:04

You are right, it`s time managment :)

Thats exact what i want, show the result in a new column and then only in the first line for each "medewerker".
But what is the best way to create such a loop?

von Sammy Broeders - am 29.10.2015 10:28
Hello Sammy,

U can make new SQL Query, make it with sum of Totaal tijd and group by Medewerker, that way you could fill new column in table by programming from results of Query.

Best regards,

Ivan V.

von Ivan V. - am 29.10.2015 12:09
Hi Sammy,

i am doing something like this:

sum is int = 0
temp_mederworker = table[1].mederworker
for i=1 to tablecount(...)
if temp_mederworker = table.mederworker
sum += table.tijd
else // mederworker has changed
table[i-1].sumtijd = sum
sum = table.tijd
temp_mederworker = table.mederworker
// take care if last mederworker
table[i-1].sumtijd = sum

not tested, may be small bugs inside, but principle is used by me often.
Writes the sum at the last line of each mederworker.
If sum should be at the first line of mederworker, just invers the Loop:
for tablecount(..) to 1 step -1
and adjust Initial Settings,...

Hope this helps.


von Erik Schwarz - am 29.10.2015 12:56

any my text got formatted some weird.

Table ... should always be like table


von Erik Schwarz - am 29.10.2015 13:12
[attachment 1749 Knipsel.JPG]

Now i dit it with a break because the looper works not as i want.

Thanks all.

von Sammy Broeders - am 29.10.2015 16:08
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.