Step 2. Use the Command Assistant

In this step you will learn how to use the Command Assistant to create SELECT database command to retrieve all fields from the xEmployee table. The finished command will appear as follows:

Select Fields(#xEmployeeIdentification #xEmployeeSurname #xEmployeeGivenNames #xEmployeeStreet #xEmployeePostalCode) From_File(xEmployee)

Endselect

Note: Experienced developers could quickly type this command into the editor, and the Autocomplete assistant would complete code and variables as they are typed (see later). The Assistant is particulary helpful when a parameter needs a number of field names. By displaying Fields by Table, the fields can be selected in one step.

1.  At the end of the source for the form iiiDragandDrop create a GetData method. We could extend this form to load list data from a table such as xEmployee.

Mthroutine Name(GetData)

Endroutine

2.  Add a blank line in the GetData routine and press F4 to re-display the Command Assistant as a floating window. Note that it has the size and position which you gave it earlier.

3.  Select the Commands tab.

a.  Locate the SELECT command. (You can simply set focus on an item in the list of commands and type the letter S to position to commands starting with S.)

b.  Press Enter to select the SELECT command in the list of commands.

c.  The SELECT command is displayed in the Command Assistant.

4.  Use the down cursor key to move to the FROM_FILE parameter.

a.  On the right hand side, the Files tab should now be selected.

b.  Position the cursor in the Table Name box on the Tables tab. Type xe in the Table name field to display tables starting with xe.

c.  Select the xEmployee table and press Enter.

d.  The From_File parameter in the SELECT command will be updated.

5.  On the left hand side, position the cursor in the FIELDS parameter for the SELECT command.

     On the right hand side, select the Fields by Tables tab and expand the table xEmployee to display all fields in the table.

     You can now choose the fields that you want to include in the Fields parameter of the SELECT command. For this example, using the Ctrl+Left mouse button, select the fields xEmployeeIdentification, xEmployeeSurname, xEmployeeGivenNames, xEmployeeStreet and xEmployeePostalCode.

6.  Press Enter. The Fields parameter in the SELECT command will now be updated:

7.  Close the Command Assistant. Your code now looks like the following: