Retrieving data using the FIND and GET statements
The FIND
and GET
statements are two of the most commonly used functions in NAV programming. When it comes to retrieving data, we need to select the right FIND
/GET
function as it has a significant effect on the performance of the system. This recipe will help you understand how to use the FIND
and GET
functions.
How to do it...
Create a new codeunit with Object Designer.
Add the following local variables into the
run
trigger:Name
Type
Subtype
Customer
Record
Customer
CustCount
Integer
Add the following code into the
OnRun
trigger of the codeunit://FINDFIRST Customer.RESET; IF Customer.FINDFIRST THEN MESSAGE('The first customer in the database is:\No.:%1\Name:%2', Customer."No.", Customer.Name); //FINDLAST Customer.RESET; IF Customer.FINDLAST THEN MESSAGE('The last customer in the database is:\No.: %1\Name:%2', Customer."No.", Customer.Name); //FINDSET Customer.RESET; IF Customer.FINDSET THEN REPEAT...