eg
SELECT [Document No_], SUM([Cost Amount (Actual)]) DocTotal
FROM [Cronus$Value Entry]
WHERE ([Posting Date] = '2007-01-01')
GROUP BY [Document No_]
What is the best translation for such a statement into Navision c/side?
Required analysis is the least cost or fastest time.
This is a an ad-hoc based selection.
Is there any more efficient way of doing other than this:
1. select all distinct Document No. & insert into temp table
2. loop through the temp table & for each Document No., loop through the Value Entry table again & sum based on the Document No.
NAV - Norton Anti Virus
ERP Consultant (not just Navision) & Navision challenger
0
Comments
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I hope you do not mind if I suggest an improved version of the code:
valueentry.setrange("Posting Date",'whatever date');
if valueentry.findset then
repeat
tempvalueentry.setrange("Document No.",valueentry."Docment No.");
if not tempvalueentry.findfirst then
begin
tempvalueentry.init;
tempvalueentry."Document No." := valueentry."Document No.";
tempvalueentry.insert;
end;
tempvalueentry."Cost Amount (Actual)" += valueentry."Cost Amount (Actual)";
tempvalueentry.modify;
until valueentry.next = 0;
The reason I think this is better is the fact that in your example the code for processing the temp record once you had it was written twice. So if you wanted to add to the code later you would need to write same thing in both places.
This way you only have one place you write it in.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Guess this standard way is already the most efficient...
ERP Consultant (not just Navision) & Navision challenger