When you only want to know if a table contains no records (with applied filters) and you don't need the actual record(s), what to use: ISEMPTY or FINDFIRST?
recMyRec.SETCURRENTKEY(...);
recMyRec.SETRANGE(Field,...);
IF recMyRec.ISEMPTY THEN
...
or
recMyRec.SETCURRENTKEY(...);
recMyRec.SETRANGE(Field,...);
IF NOT(recMyRec.FINDFIRST) THEN
...
Is there a performance (or other) difference between the two?
No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
Answers
FINDFIRST will read the data from disk into memory and transport it to the client.
IsEmpty will only look in the index and return true or false.
FINDFIRST => SELECT * TOP 1
ISEMPTY => SELECT TOP 1
As you can see, ISEMPTY fetches no fields but FINDFIRST fetches the whole record.
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
Nope, but almost. :-s
IsEmpty does a Select Top 1 NULL FROM...
NULL means that no data is read from the table or index.
see also my Blog
http://dynamicsuser.net/blogs/mark_brum ... 07/04.aspx
http://www.qurius.eu/Learning/NL/index. ... Itemid=156
O:)