TOC PREV NEXT INDEX



Mapping the second query


We will now set up the UI mapping so the user will be able to interactively change the query. We are going to re-use all of the textfields, the list and the table as the places to display our output, so the program will appear to function the same for both queries.

  1. Select the UI Mapping page of the Database Editor.
  2. Scroll the tree toward the bottom, so that you can see the second query, which you have named 'descriptionQuery'.
  3. Expand the 'descriptionQuery' node of the tree, if it is not already expanded. You may wish to collapse the 'inStock' node of the tree to avoid confusion.
  4. Click once on "DESCRIPTION" in the part of the tree which is under 'descriptionQuery'.
  5. Select 'description', 'listOfDescriptions', and 'bigTable' from the area to the right.
  6. Click once on "PRODUCT_NUM" in the same part of the tree.
  7. Select 'productNumber' and 'bigTable' from the area to the right.
  8. Map "PURCHASE_COST" to 'purchaseCost' and 'bigTable' in the same manner.
  9. Map "QTY_ON_HAND" to 'quantityOnHand' and 'bigTable' in the same manner.
  10. Map the "< Next >" and "< Previous >" actions to the "Next" and "Previous" buttons.
  11. Map the "< Goto Specific Record >" action to both 'listOfDescriptions' and 'bigTable'.
    (Notice that we have set up all the output fields the exact same way as in the first query.)
  12. Map the "< Execute Statement >" action to the 'searchFor' item on the right to associate it with the 'descriptionQuery'.
  13. Click on the item in the tree which reads "[ 'cable' ]". Before executing the SQL statement, we want to replace the text 'cable' with the value the user entered into the JTextField so users can specify what to search for. The input field that is chosen here will supply the new text.
  14. Select "nameToSearchFor" from the right hand column to map that JTextField to the 'cable' parameter.
  15. Press "Apply Changes".

You may now close the Database Editor and test your application.

  1. Press the "Connect" button in your application to connect to the database.
  2. Type something to search for in the text field at the bottom. Try typing "computer", "dev", and "ram" in the text field at the bottom of the program and then pressing the 'Search for' button.
  3. Try the "Next" and "Previous" buttons, as well as selecting a row from the table or the list.
  4. Now press the "Show available items" button. Try the "Next" and "Previous" buttons, as well as selecting a row from the table or the list.

Notice that you mapped the "Next" and "Previous" buttons to two different queries. The code generated by the Database Editor is able to distinguish which query is the appropriate one to use based on which results are currently displayed by the components. The "Goto Specific Record" action works the same way for both queries.


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