Hi All,
Anyone know what does the below statement mean?
Rec.FIND('=><')
I found this at T5606, function GetGenJnlDocumentNo.
Thank you.
Regards
Rachel
REC.FIN('=><'); is a function designed to optimize the process of finding the first record in a record set in the Navision Native database (if setup correctly). Its actually left over from the DOS days, and personally I doubt its value these days, and now I always replace it with the new command FINDFIRST.
Basically the way it work is this:
If you have already accessed any record int he current filter set, then that record would normally still be in cache, so the "=" will return that cached record without needing a disk access. This means you can start your processing immediately. Basically this is saying "we have a record in a variable that has the same primary key, but maybe the other fields have been changed so let's just go and refresh from the database.
The next thing, is to look at the quickest record to find next. Now so long as you followed the rules, and built Navision on multiple RAID 1 drives, (and not raid 10 or 5) then Navision will have tried to write the records sequentially as they were created across multiple drives, so the logic is that since the spindles are spinning in a forward direction, and assuming you have optimized spin latency.Then the next record in the current set will be found using the ">" command.
If none of those are found, then the system will find the record that is stored first on the drive with "<".
But today with intelligent disk controllers it really makes no sense. Today we let the hardware people worry about all that stuff. So just think that if you see Navision use the code, then in 99.9% of cases it can be replaced with FINDFIRST.
In reality though, maybe a better command might be FINDANY, but I can't see that its worth it.
Use FINDFIRST when you actually need that data of that record.
If you don't need data and you only want to see if there is a record for that filter, use ISEMPTY.
If you're going to loop the data, use FINDSET or FIND('-') (if the set is probably over 500 records)
Use FINDFIRST when you actually need that data of that record.
If you don't need data and you only want to see if there is a record for that filter, use ISEMPTY.
If you're going to loop the data, use FINDSET or FIND('-') (if the set is probably over 500 records)
Yes sorry, you are right, FINDSET is generally probably the correct replacement in most cases, not FINDFIRST.
Comments
so in your case, a record that equals, is larger or is less than that value :-k .
Probably it has assigned values to all parts of the primary key ... may be you can add some more code to see what it does in this case?
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
What version are you using?
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
It's T5605.
REC.FIN('=><'); is a function designed to optimize the process of finding the first record in a record set in the Navision Native database (if setup correctly). Its actually left over from the DOS days, and personally I doubt its value these days, and now I always replace it with the new command FINDFIRST.
Basically the way it work is this:
If you have already accessed any record int he current filter set, then that record would normally still be in cache, so the "=" will return that cached record without needing a disk access. This means you can start your processing immediately. Basically this is saying "we have a record in a variable that has the same primary key, but maybe the other fields have been changed so let's just go and refresh from the database.
The next thing, is to look at the quickest record to find next. Now so long as you followed the rules, and built Navision on multiple RAID 1 drives, (and not raid 10 or 5) then Navision will have tried to write the records sequentially as they were created across multiple drives, so the logic is that since the spindles are spinning in a forward direction, and assuming you have optimized spin latency.Then the next record in the current set will be found using the ">" command.
If none of those are found, then the system will find the record that is stored first on the drive with "<".
But today with intelligent disk controllers it really makes no sense. Today we let the hardware people worry about all that stuff. So just think that if you see Navision use the code, then in 99.9% of cases it can be replaced with FINDFIRST.
In reality though, maybe a better command might be FINDANY, but I can't see that its worth it.
Use FINDFIRST when you actually need that data of that record.
If you don't need data and you only want to see if there is a record for that filter, use ISEMPTY.
If you're going to loop the data, use FINDSET or FIND('-') (if the set is probably over 500 records)
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
Yes sorry, you are right, FINDSET is generally probably the correct replacement in most cases, not FINDFIRST.
Thank you for the clarifications.
Regards
Rachel