It's easy enough to put data into the database, but how do you write code to get it back out? There are several ways and this recipe will discuss the first and easiest.
Create a new codeunit from Object Designer.
Add the following global variable:
Add the following code to the
OnRun
trigger of your codeunit:Customer.GET('10000'); MESSAGE('No: %1\Name: %2', Customer."No.", Customer.Name);
Save and close the codeunit.
When you run the codeunit you should see a window like the following:
The GET
command works in conjunction with the primary key of the record. For the customer table, the primary key is No.. If you are unsure of the primary key for the table you are using, you can view the keys for the table and check the first entry.
We first tell the database to go to the customer table and GET the record that has a No. field equal to 10000. We then display the number...