So I am trying to sum the Base and Amount of VAT Entry Table.
But for only those records that have a particular Global Dimension.
So from the GL Entry Table I can get all the Document No. filtered on the Global Dimension 1 I want.
Then I want to filter the VAT Entry table with those Document No. found from GL Entry table and Sum their Base and Amount.
Here is what and not getting the expected result for the sake of this example we will call the Global Dimension 1 as 'AB'
On my report's (which has VAT Entry as its dataitem) onaftergetrecord()
GLEntry.SETFILTER("Global Dimension 1 Code", 'AB');
"VAT Entry".SETFILTER("Document No.", GLEntry."Document No.");
"VAT Entry".SETFILTER("Type", 'Sale');
"VAT Entry".SETFILTER("VAT Prod. Posting Group", '5% VAT');
IF "VAT Entry".FINDSET THEN BEGIN
REPEAT
TotalPS := TotalPS + "VAT Entry".Base;
TotalVATAmountPS := TotalVATAmountPS + "VAT Entry".Amount;
UNTIL "VAT Entry".NEXT=0;
END;
The result I get tells me GLEntry.SETFILTER("Global Dimension 1 Code", 'AB'); didn't work.
Any hint would be highly appreciated thanks in advance.