YourRecVariable.setcurentkey(YourKeyField(s));
YourRecVariable.ascending(false);
if YourRecVariable.findset(false,false) then begin
repeat
until YourRecVariable.next = 0;
end;
But as kine said, it's not good for performance (if you have many recs in your table.
If you need a descending key often and you are under SQL you can also define in SQL Managm. Studio a descending index on your table.
E.g in the table I have the following data;
Part-number1 EntryNo1
Part-number2 EntryNo2
Part-number3 EntryNo3
Part-number4 EntryNo4
Part-number1 EntryNo5 <- I need to pick-up this record instead of the one at the top as this is the latest of Part-number1
Part-number5 EntryNo6
As you can see by reading descending order, I can pick up the latest of Part-number1 transaction.
Answers
IF Record.FIND('+') THEN
IF Record.FINDLAST THEN
This is not good for looping. Never use FINDFIRST and FIRSTLAST when looping through table.
And going through table backwards is not good for performance on MS SQL at all...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Could you provide a sample coding on the ascending on how to use
[IsAscending] := Record.Ascending ([SetAscending]}
Thanks
But as kine said, it's not good for performance (if you have many recs in your table.
If you need a descending key often and you are under SQL you can also define in SQL Managm. Studio a descending index on your table.
Regards
Thanks for the advice.
I only need to read once only and then out of the loop.
Regards
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
E.g in the table I have the following data;
Part-number1 EntryNo1
Part-number2 EntryNo2
Part-number3 EntryNo3
Part-number4 EntryNo4
Part-number1 EntryNo5 <- I need to pick-up this record instead of the one at the top as this is the latest of Part-number1
Part-number5 EntryNo6
As you can see by reading descending order, I can pick up the latest of Part-number1 transaction.
Hope it clarify my intention.
Regards
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Unfortunately, my version do not have "FINDLAST".
Regards
ERP Consultant (not just Navision) & Navision challenger
Do you need to modify the last rec or not? If yes set a locktable before, so the server knows, that you will modify the rec.
Regards
No modification is required, just reading only.
Thanks for the great help.
My problem has being resolved.
Regards