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
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso My Blog
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.
Ahmed Rashed Amini
Independent Consultant/Developer
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:
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso My Blog
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)
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso My Blog
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.
Ahmed Rashed Amini
Independent Consultant/Developer
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.
...
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.
...
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.
So what if it's > 50? The statement will be repeated?
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 challenger
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.
Hi
If you are using FINDFIRST Then No. of records are retrive slowly as compare to FIND('-').
So use FIND('-') for better performance.
?? FINDFIRST does exactly as it says on the box...it retrieves the FIRST, and ONLY the first record it finds ( or none, of course ). if you need only 1 record, this performs much better than FIND('-') !
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.
If you are using FINDFIRST Then No. of records are retrive slowly as compare to FIND('-').
So use FIND('-') for better performance.
You are getting things confused here. Read back through the replies in this thread to learn more about the difference between FIND('-') and FINDSET. Not FIRST, but SET.
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>
Comments
anyway, NEVER use findfirst with loops, but sometimes find('-') is better than findfirst
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
could you explain the scenario where fin('-') is better than findfirst.
Excluding loops off course.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Sorry, i mean better than findset... :oops:
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
I can't remember the scenario though.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
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)
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
The mentioned that performance was better with 50. I wonder on how large of database did they do the test.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I read in a post here in mibuso... here it is
http://www.mibuso.com/forum/viewtopic.php?f=32&t=30687&hilit=recordset
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
So what if it's > 50? The statement will be repeated?
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?
ERP Consultant (not just Navision) & Navision challenger
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
If you are using FINDFIRST Then No. of records are retrive slowly as compare to FIND('-').
So use FIND('-') for better performance.
IBIZ Consulting Services,India
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.
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>
RIS Plus, LLC
MVP - Business Apps
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog