Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 2 Jahren, 6 Monaten
Letzter Beitrag:
vor 2 Jahren, 6 Monaten
Beteiligte Autoren:
Erik Schwarz, Piet van Zanten, Jeff Graham

[WD19] Table break calculation problem

Startbeitrag von Erik Schwarz am 20.12.2015 19:11


I have a table (filled by programming with tableaddline) with two breaks on it and let calculate totals and subtotals.

So far this works, but the calculation seemes to be done not before the corresponding part of the table is displayed.

So if I Loop through the table to do some more calculation using the automatic results of the totals, most times the result is false. If i do the calculation while the corresponding part of the table is visible, then the result is ok.

Actually if you scroll through the table with the srollbar, so that each entry is seen at least once, and then do the additional calculations, all is ok.

Putting the code in the Display of break Event does not help, sometimes wrong, sometimes good.

Any ideas out there?



I had a similar problem where I also had to run a secondary query for calculations. So I wrote an update procedure called after the TableDisplay the looped through the table and used the TableBreakSubscript command to locate where the break controls to update were located.


Sample of code:

Message("Updating R & I totals...")
gwsPrevPartID = ""
nRows is int = TableCount(TBL_CostHistory)

FOR i = 1 TO nRows
IF modulo(i,20) = 0 THEN
Message(StringBuild("Updating R & I totals: %1 of %2",i,nRows))
iBreakNdx is int = TableBreakSubscript(RUPT_BreakFooter_Part_ID,i)
IF gwsPrevPartID COL_PART_ID THEN // Reset total fields as soon as Part_ID changes
// gwiCurrentRow = 0
TBL_CostHistory[iBreakNdx].EDT_R_Qty = 0
TBL_CostHistory[iBreakNdx].EDT_R_TotalCost = 0
TBL_CostHistory[iBreakNdx].EDT_I_Qty = 0
TBL_CostHistory[iBreakNdx].EDT_I_TotalCost = 0
TBL_CostHistory[iBreakNdx].EDT_I_TotalPrice = 0
gwsPrevPartID = COL_PART_ID
TBL_CostHistory[iBreakNdx].EDT_R_Qty += COL_QTY
TBL_CostHistory[iBreakNdx].EDT_R_TotalCost += COL_TotalActCost
IF TBL_CostHistory[iBreakNdx].EDT_R_Qty 0 THEN
TBL_CostHistory[iBreakNdx].EDT_R_AvgCost = (TBL_CostHistory[iBreakNdx].EDT_R_TotalCost/TBL_CostHistory[iBreakNdx].EDT_R_Qty)
TBL_CostHistory[iBreakNdx].EDT_I_Qty += COL_QTY
TBL_CostHistory[iBreakNdx].EDT_I_TotalPrice += COL_PriceXQty

von Jeff Graham - am 20.12.2015 22:53
Hi Ericus,

An "offline" calculation can look like this:


von Piet van Zanten - am 21.12.2015 10:24

Re: [WD19] Table break calculation problem (SOLVED so far)

Hi all,

not what could be wished, but works so far:

At least the calculation must be done in each 'Display break' process (I have two nested breaks) and(!) the calculation must be done for each available break in the table then.

Your hints finally gave me the solution (better saying workaround) fot the Problem.

Thanks and have a nice Christmas


von Erik Schwarz - am 21.12.2015 14:24
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.