Is it possible to check if a record- variable isn't empty? This is what I want to do:
Record.GET(som primary key value);
The check would return TRUE here, since we have a record.
CLEAR(Record);
The ckeck should now return FALSE, since the record-pointer points to "no-where"...
0
Comments
RIS Plus, LLC
From help:
ISEMPTY (Record)
Use this function to find out whether a C/SIDE table or a filtered set of records is empty.
Empty := Record.ISEMPTY
Record
Data type: record
Refers to the table or the filtered set of records to be checked.
Empty
Data type: boolean
Comments
This function tells you whether the table is empty or not if you have not applied filters to the record. If you have applied filters, the function determines whether the filtered set of records is empty.
The number of filters that you have applied to the records affects the speed of the ISEMPTY function. The fewer the number of filters, the faster the system performs the operation.
When you are using SQL Server, this function is faster than using the Record.COUNT function and then testing the result for zero.
Tino Ruijs
Microsoft Dynamics NAV specialist
2) your record variable Record may hold outdated values both for primary key (table record got deleted or renamed by someone) and for other field (someone modified your current record)
one thing you could do to update your information is to reget your record
Record.GET(Record."Primary Key Field(s)")
For me main question is "Why you need that"?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I want to prevent to many database calls: For example a setup table is being used many places. If the table have been read once from the database, theres no need to read it again....
What do you mean with "points to no-where" ?
Your initial question was "if a record is empty".
BR Per
I don't think a couple of extra recSetup.GET(); will influence the performance of the database.
Off course it's important you place the recSetup.GET(); in the right place. Not for example in a repeat-until-loop.
Tino Ruijs
Microsoft Dynamics NAV specialist
It means that special global variable GLSetupRead is used to flag if the setup was read or not. You can use SingleInstance codeunit with such a function which will return the record as a parameter to read the setup table just once in one session (but it means that when you change the setup, you need to restart the client to have new setup) and call that codeunit's function everywhere in code when you need to get the setup...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.