I want to print a list like the one below from Cust. Ledger Entry table for a period.
Purpose is to print the no of unique customers the sales person touched (brought sales from) during that period.
Salesperson NoOfUniqueCustomers
AAA XXX
BBB XXX
I can't find a way to do it easily in NAV 4.0 SP3 - SQL
Pls help me to write a code to get this as my plan is to have a common "function" in a code unit.
Thank you
Maluwa
Answers
If you want a function to do it you're going to have to sort the list by Salesperson and Customer and count them up every time the customer changes.
Counting the number of unique records is not one of NAV's strong areas.
My Blog - nav.education
In NAV function "group by" in c/al like this just schematic
Best Regards
DATA01
DATA02
DATA01
DATA01
DATA02
DATA03
--> But i want to make like this
DATA01
DATA02
DATA03
how to do that?
like disctinct in sql syntax
Then you can group Cust. Ledger entry on Customer No., and have summaries for each customer under the Salesperson section.
"Profanity is the one language all programmers know best."
Andwian
thanks Andiwan
Anyway, is it works?
I have to admit that these codes are not so "efficient" though. You can try the suggested method by Yaroslav .
This code is more optimized to search for the only unique records, by always FINDLAST for the common records, but of course you have to set is as the current key.
Andwian