Select Statement
The second option in the code wizard menu enables developers to create a block of program code to read records from the database.
Step 1 | Set the cursor at the place in your code where you want to insert the new code lines. |
|
Step 2 | Start the code wizard. This can be done by clicking the right mouse button and choosing "Code Wizard" from the popup menu, or by using the shortcut "Ctrl+W". |
|
Step 3 | Choose "Select statement" and click "Next". |
|
Step 4 | Choose the table query that you want to use and click "next". A number of lines will be added to your code. |
|
Step 5 | In the top part of the screen you can now select with which index you want to read the records in the table. And in the bottom part of the screen you decide on the method with which you want to retrieve the records (getfirst, equal, start, etc). If needed the isolation level can be set to Read Committed. You can check the table and table query used again in the top of the screen. See screenshot.
|
|
Step 6 | After clicking 'Finish' you will see that the basic code lines of a table query read have been added to your code.
tq-cust.index (idx_cust_custno)
tq-cust.equal (<cust_no>) loop tq-cust endloop |