Loop a table without SETRANGE

hungryandfool
Member Posts: 114
Dear Experts,
I have a requirement to loop an entire table ("User" table). For the same I just did a FIND('-') on the table record variable and put the record variable in the REPEAT - UNTIL NEXT = 0 structure. But the mentioned structure only accesses te first record of the table. May be since I am not using SETRANGE so the REPEAT - UNTIL NEXT = 0 is only accessing the first record.
Can you help me out with the issue?
Thanks a lot.
I have a requirement to loop an entire table ("User" table). For the same I just did a FIND('-') on the table record variable and put the record variable in the REPEAT - UNTIL NEXT = 0 structure. But the mentioned structure only accesses te first record of the table. May be since I am not using SETRANGE so the REPEAT - UNTIL NEXT = 0 is only accessing the first record.
Can you help me out with the issue?
Thanks a lot.
0
Answers
-
Can you post your code ? With just this description we can't tell you what is wrong ( although i SUSPECT you might have forgotten to add the tablename to your NEXT=0, which is something i see consultants who try to program do often )0
-
Hi MBerger,
Thanks for replying.MBerger wrote:Can you post your code ? With just this description we can't tell you what is wrong ( although i SUSPECT you might have forgotten to add the tablename to your NEXT=0, which is something i see consultants who try to program do often )
My code is as follows:
User.RESET();
IF User.FIND('-') THEN BEGIN
REPEAT
GenJouBtch.RESET();
GenJouBtch.SETRANGE("Journal Template Name",'JOURNAL VO');
GenJouBtch.SETRANGE(User,User."User ID");
IF NOT GenJouBtch.FIND('-') THEN BEGIN
GenJouBtch.INIT();
GenJouBtch."Journal Template Name" := 'JOURNAL VO';
GenJouBtch.Name := User."User ID";
GenJouBtch.Description := FORMAT(User."User ID")+' '+FORMAT('Batch');
GenJouBtch."Bal. Account Type" := GenJouBtch."Bal. Account Type"::"G/L Account";
GenJouBtch."No. Series" := 'UJV/HO';
GenJouBtch."Posting No. Series" := 'JV/HO';
GenJouBtch."Copy VAT Setup to Jnl. Lines" := TRUE;
GenJouBtch."Allow VAT Difference" := FALSE;
GenJouBtch."Sub Type" := GenJouBtch."Sub Type"::"Journal Voucher";
GenJouBtch.User := User."User ID";
GenJouBtch."Template Type" := GenJouBtch."Template Type"::General;
GenJouBtch.Recurring := FALSE;
GenJouBtch.INSERT();
END;
UNTIL GenJouBtch.NEXT=0;
END;0 -
hungryandfool wrote:UNTIL GenJouBtch.NEXT=0;
UNTIL User.NEXT=0;
0 -
mohana_cse06 wrote:hungryandfool wrote:UNTIL GenJouBtch.NEXT=0;
UNTIL User.NEXT=0;
Thanks a lot mohana. =D>
I don't know what should I call myself. :oops: ](*,)0 -
-
and it seems i was right too0
-
MBerger wrote:and it seems i was right too0
-
MBerger wrote:and it seems i was right too
Sorry for replying late, but many many thanks to you too MBerger =D> \:D/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