Dear NAV experts,
I implemented a few functions in the past which required the use of something like a COUNT unqiue. Currently Navision doesn’t seem to have this in the language, which one could easily achieve using plain T-SQL:
SELECT DISTINCT [Item No_]
FROM SomeTable
WHERE set some filtering criteria…
So I ended up having to
SomeTable.RESET;
SomeTable.SETCURRENTKEY(“Item No.”);
SomeTable.SETFILTER(“Document No.”,’=%1’,‘S19225…’)
IF SomeTable.FINDFIRST THEN BEGIN
Count := 0; // Local variable
ItemNo := ‘’ // Local variable
REPEAT
IF Item No <> SomeTable.“Item No.” THEN BEGIN
Count := Count + 1;
ItemNo := SomeTable.“Item No.”;
END;
UNTIL SomeTable.NEXT = 0;
END;
EXIT(Count);
Is there any smarter way of doing a COUNTUNIQUE in Navision?
Scott