Notifications
Announcements
No record found.
Hello Expert,
I am trying to find last second record of the table but my program is not working. Can anyone please help.
Count1:=0;IF Cust.FIND('+') THEN REPEAT Count1:= Count1 +1; UNTIL Cust.NEXT= -1;
Thanks in advance.
Nia
Why not just use FINDLAST
dynamicsuser.net/.../query-on-find-findset-findfirst-findlast
You can loop backwards using the below record or you could set the SETASCENDING to false on the key and loop
IF Cust.FINDLAST THEN
REPEAT
UNTIL Cust.NEXT(-1) = 0;
Hi Suresh,
i tried your code and even i had almost same code but result runs in loop. I want to show only single record and then the function should exit.
MESSAGE(Cust."No.");
Count1:=0;
IF Cust.FIND('+') THEN
Cust.NEXT:= -1;
i tried above and could achieve the result but it shows the record multiple times.
Nia, it will not just exit the look, you need to add the condition like this or when you get your record assign a boolean to true and add that after the next condition..
i := 0
i += 1;
IF i =2 THEN BEGIN
END;
UNTIL (Cust.NEXT(-1) = 0) or (i =2);
Hi Nia,
The following code will work perfectly whenever you want to find the second last record and no looping required at all. When you use my code you have to use at least 2 variables of record type for the same table. {example using the customer table}
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
OussamaSabbouh 3,151
Jainam M. Kothari 1,443 Super User 2025 Season 2
YUN ZHU 1,092 Super User 2025 Season 2