TOC PREV NEXT INDEX



Displaying database results


Now we will display the results of your search in your user interface.

  1. Select the "UI Mapping" tab of the Database Editor.

On the left of the screen you will see a tree with two items at the top level: "Database Connection" and "inStock". The "Database Connection" area has 6 items in it, including a database action called "Open Connection". You can map a a database action to a button by selecting the action in the tree and then selecting the button in the list on the left.

We will now map the "Open Connection" database action to a button, so that your program can open a connection to the database before it performs the search.

  1. Select the "<Open Connection>" item in the tree. You will see a list of items on the right which can open a database connection when they are activated.
  2. Select "connect", the button which you set up previously, by clicking on it once in the list. It will now open a connection when it is pressed.

The tree will immediately update to show that the connect button will open a connection.

Next we will set up the display of the information from the database.

  1. Click on "PRODUCT_NUM" in the tree (under inStock). The list to the right will show possible objects which may display the information in the PRODUCT_NUM column.
  2. Choose "productNumber", the textfield you created earlier, by clicking on it once in the list. The tree will update to show that the PRODUCT_NUM column will be displayed in "productNumber".
  3. Click on "DESCRIPTION" in the tree.
  4. Choose "description" from the list to the right.
  5. Map "PURCHASE_COST" in the tree to "purchaseCost" in the same manner.
  6. Map "QTY_ON_HAND" in the tree to "quantityOnHand" in the same manner.
  7. Click on "<Execute Statement>" in the tree. You want the search to be performed when the button called "showAvailable" is pressed.
  8. Choose "showAvailable" from the list to the right.

Since TextFields can only show one row at a time, you need a way to go forward and backwards among the rows.

  1. Map the "< Goto Previous Record >" action in the tree with the "previous" button from the list on the right.
  2. Map the"< Goto Next Record >" action in the tree with the "next" button from the list on the right.

If you make a mistake, you can always deselect something from the list on the right by clicking it again.

  1. Press the "Apply changes" button in the bottom right-hand corner to update your user interface with the changes you have made.

You may now close the database editor.

You have now finished creating a program which connects to a database, sends a query to it, and displays the results. Let's test it.

  1. Press the "connect" button in your program to connect to the database.
  2. Press "show available items" button to perform the search.

The "previous" and "next" buttons will let you browse through the resulting records.


Data Representations, Inc.
http://www.datarepresentations.com
support@datarepresentations.com
sales@datarepresentations.com
TOC PREV NEXT INDEX