total fields in a dataport

I created a new dataport and I need to Sum all Quantitys and Amount values of my Purchase Invoice Header in a FilterDate.

How can I do That??

What have you already tried?

I craeted in my dataItem table dataPort (Purchase Invoice lines) 4 new fields, FlowField type.

Each one with CalcFormula like

Sum(“Purchase Line”.Quantity WHERE (Product Group Code=CONST(EXTRA)))

In my Dataport I call these new fields…

Where is your CALCFIELDS?

In Purch. Inv. Line - OnBeforeExportRecord()

EX:

PurcInvLine.CALCFIELDS(EXTRA);

Those are different record variables.

PurchInvLine appears to be a local or global variable. “Purch. Inv. Line” is probably your data item. You’re doing the CalcFields on the global variable and probably exporting the value from the data item.

You need to do the CALCFIELDS on what you are actually exporting, or change your DataItem Fields (Export Fields) to what you are doing the CALCFIELDS on.

Additionally, there is a CalcFields property on the data item that you could use.