FINDSET and FINDFIRST

souravb
Member Posts: 135
I am using NAV 4.0 SP3 with SQL Server 2000. Is it better to use FINDFIRST with Repeat...Until OR FINDSET with Repeat...Until?. Please Advice.
0
Comments
-
enter c/al editor, press F1 and search findset in the online help, there, you'll see the correct use of these statements
anyway, NEVER use findfirst with loops, but sometimes find('-') is better than findfirst0 -
I think that there are many posts about that on the forum, it is documented in manuals, it is described on blogs.0
-
also you can find the quick reference in the download section.Do you make it right, it works too!0
-
Belias wrote:enter c/al editor, press F1 and search findset in the online help, there, you'll see the correct use of these statements
anyway, NEVER use findfirst with loops, but sometimes find('-') is better than findfirst
could you explain the scenario where fin('-') is better than findfirst.
Excluding loops off course.0 -
ara3n wrote:Belias wrote:enter c/al editor, press F1 and search findset in the online help, there, you'll see the correct use of these statements
anyway, NEVER use findfirst with loops, but sometimes find('-') is better than findfirst
could you explain the scenario where fin('-') is better than findfirst.
Excluding loops off course.
Sorry, i mean better than findset... :oops:0 -
oh np. I've heard that as well.
I can't remember the scenario though.0 -
FINDSET, find "n" records in the table, where "n" is the value of recordset property.
if the developer knows that the no. of retrieved records after a set of filters are bigger than recordset value, it's better to use find('-') because it will find all the resulting records.
In this way Nav and/or sql does not have to refill the cache after "n" reads (maybe the last sentence I wrote is not 100% correct)0 -
Oh yes, the number of records. They've changed it from 500 in 5.0 to 50 in 2009.
The mentioned that performance was better with 50. I wonder on how large of database did they do the test.0 -
ara3n wrote:Oh yes, the number of records. They've changed it from 500 in 5.0 to 50 in 2009.
The mentioned that performance was better with 50. I wonder on how large of database did they do the test.
I read in a post here in mibuso... here it is
http://www.mibuso.com/forum/viewtopic.php?f=32&t=30687&hilit=recordset0 -
Belias wrote:...
if the developer knows that the no. of retrieved records after a set of filters are bigger than recordset value, it's better to use find('-') because it will find all the resulting records.
...ara3n wrote:Oh yes, the number of records. They've changed it from 500 in 5.0 to 50 in 2009.
The mentioned that performance was better with 50. I wonder on how large of database did they do the test.
Is this the path Nav is moving towards? Small databases? Non-uniformed/inconsistency in functions where developer of module A will use FIND('-') while developer of module B will use FINDSET?NAV - Norton Anti Virus
ERP Consultant (not just Navision) & Navision challenger0 -
No. If you are iterating through ledger entries, you can assume that the count will be big. If you are iterating document lines, you can assume that there will be only some maximal count of the lines. That's the difference. There is more and more entries during time, there is still average same count of lines per document during time etc.0
-
Hi
If you are using FINDFIRST Then No. of records are retrive slowly as compare to FIND('-').
So use FIND('-') for better performance.Devendra Kr. Sharma
IBIZ Consulting Services,India0 -
devu_13 wrote:Hi
If you are using FINDFIRST Then No. of records are retrive slowly as compare to FIND('-').
So use FIND('-') for better performance.
Why you should never use FINDFIRST in conjunction with a REPEAT..UNTIL NEXT loop is that this will in at least 2 DB-calls; as soon as it detects the NEXT statement, it will still have to retrieve the recordset. Using either FINDSET or FIND('-') is better in this case, because it will already have gotten multiplt records ( if any ) into memory.0 -
devu_13 wrote:If you are using FINDFIRST Then No. of records are retrive slowly as compare to FIND('-').
So use FIND('-') for better performance.
FINDFIRST is not meant to be used when you need to loop through a set of records. FINDFIRST only retrieves one record, so when you do NEXT, the system now has to guess as to what you want to do, and since you're using the wrong keyword in the first place, it has to get more records, so it's another query, and the system slows down from there.
So yes, FIND('-') is faster than FINDFIRST for loops, because FINDFIRST is the wrong keyword to use in a loop to begin with.
<edit> sorry MBerger, I hadn't seen your reply yet :whistle: </edit>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