Help with REPEAT ... UNTIL !

jeromecorriveau
Member Posts: 13
I did a loop and i would like to have the previous record of that loop (not the last record). How can i get the previous record ? My loop type is REPEAT...UNTIL. Is it possible to give me an example ?
Thanks in advance !
Sorry my english isn't very good!
Thanks in advance !
Sorry my english isn't very good!
Jerome
0
Comments
-
MyOtherRec.INIT // now it has blank and initial values If MyRec.FINDSET THEN REPEAT // do some code in here // do some more code in here MyOtherRec := MyRec; // so in the next iteratin of the loop you have the previous one UNTIL MyRec.NEXT = 0;
0 -
Do you want the previous as in DenSters answer or are you wanting to loop backwards?
IF myRec.FIND('+')THEN // Find Last
REPEAT
{
Do something
}
UNTIL MyRec.NEXT(-1) = 0; // Move to Previous Record
The -1 is a step and you could use this to step through a record set
This can be a positive to step forwards or a negative to step backwards.
MyStep := -2; // Every Second Record
IF myRec.FIND('+')THEN // Find Last
REPEAT
{
Do something
}
UNTIL MyRec.NEXT(MyStep) = 0; // Move to Second Previous Record
Next Button Code
IF NEXT <> 0 THEN // Test for EOF
NEXT; // Move to Next Record
Previous Button Code
IF NEXT(-1) <> 0 THEN // Test for BOF
NEXT(-1); // Move to Previous Record
:whistle:Analyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0 -
David Cox wrote:Next Button Code
IF NEXT <> 0 THEN // Test for EOF
NEXT; // Move to Next Record
Previous Button Code
IF NEXT(-1) <> 0 THEN // Test for BOF
NEXT(-1); // Move to Previous Record
:whistle:
IF NEXT(1) = 0 THEN;
or:
IF NEXT(-1) = 0 THEN;0 -
DenSter wrote:David Cox wrote:Next Button Code
IF NEXT <> 0 THEN // Test for EOF
NEXT; // Move to Next Record
Previous Button Code
IF NEXT(-1) <> 0 THEN // Test for BOF
NEXT(-1); // Move to Previous Record
:whistle:
IF NEXT(1) = 0 THEN;
or:
IF NEXT(-1) = 0 THEN;
Yes you are right I was in the wrong language mindset, testing for BOF or EOF before moving the record pointer, I was away with the old VB code!Analyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0 -
I thought so. You got me a bit confused becasue I have been working with ADO recordsets lately and have gotten used to EOF and BOF properties
man it's easy to mix those up.
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions