My situation is this:
1. Sales Line table has SumIndex set up for Amount Including VAT and a new field, Line Deal Amount
2. I have a codeunit that accepts the Sales Line table. The Sales Line may or may not have a filter set on the Document Type
3. The codeunit finds the sum of Amount Including VAT and Line Deal Amount, then adds it to a running total, which is returned to the user. If the record has a Document Type of Return Order or Credit Memo, the sum needs to be multiplied by -1 before it is added to the running total.
If the Sales Line gets passed with a simple filter on the Document Type, I can easily use CALCSUMS.
If there is no filter on Document Type, I can filter for Document Type equal to returns/credits and CALCSUM and multiply by -1, then filter for everything else and CALCSUM, then add the two results.
However, I'm trying to find a way to handle more complex filters.
I was hoping I could mass transfer the filtered records over to a temp table, then do a CALCSUM similar to how I do it when I have no filter set. However, I don't think there's a command to do TRANSFERFIELDS in bulk. I also thought about trying to use FILTERGROUPs and MARK, but I don't think filtergroups can stack on an existing filter, nor can I MARK in bulk.
As a result, I have to spin through records one-by-one to get my totals no matter whether I transfer to a temp table or if I were to spin through the passed table itself.
Is there a trick that I am unaware of, or am I just stuck spinning through the records?
Michael Hollinger
Systems Analyst
NAV 2009 R2 (6.00.34463)
0
Answers
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Thanks!
Systems Analyst
NAV 2009 R2 (6.00.34463)