Nav5
Lets say I wanted to filter according to Fund on the GL Account Table. I then wanted to recalc the flowfields (Debit, Credit) that I want to show on my report and then filter out any lines that are zeroed out from the filter.
My code is pretty much:
"G/L Account".SETFILTER("Fund Filter", FundVal);
"G/L Account".CALCFIELDS("Debit Amount", "Credit Amount", "Actual");
"G/L Account".SETFILTER("Actual", '<>0');
For some reason its returning the correct set but the first record is always the first entry in the table. One that has a value of Actual = 0. I have tested this with a message. Any ideas?
EDIT:
I have it located in the Data Item Body - OnPreSelection() Trigger
0
Comments
If u set the the filter in OnPreDataItem for your flowfield, the report will calculate the values self.
So you doesn't need the calcfields (native and SQL).
Also is the calcformula of "Actual" based on the "Fund" field?
You can test it with a very simple report. New blank Report -> DataItem 15 -> G/L Account - OnPreDataItem() -> setfilter("Debit amount",'<>%1',0);
-> In the Bodysection a control with the "No."
Now, only Recs with a Debit Amount <> 0 will be showed.
regards
](*,)
Thanks. I moved the filtering to the Data Item PreDataItem and now it works fine.
Regards
You are welcome