December 2008 - Posts - Mel Balsamo
in

InfoPath Dev

This Blog

Syndication

Mel Balsamo

December 2008 - Posts

  • EnumDB vs. QueryDB

    Qdabra’s Database Enumeration Web Service was introduced on the first version of Qdabra’s Database  Accelerator (DBXL). Up until DBXL v2.1, it was being used by business organizations for their solutions to retrieve data from SQL database tables. Filtering and sorting could also be implemented with the use of additional code. On the other hand, QueryDB Web Service, which was first introduced in DBXL v2.2, provides more advanced features and methods. The built-in operations allow easy filtering and sorting. It’s been proven to work ideally for dynamic queries. Although it needs Qdabra’s Query Builder to successfully generate queries (included for free with DBXL itself), the QueryDB web service is able to complete wider and more conducive tasks.  

    Here are some additional notes to keep in mind:

    • Note that both EnumDB and QueryDB web services require registration of query databases in the web.config file. 
    • If you migrate a document type that has EnumDB connection specified, the SQL Server is preserved when Document Migration Tool (i.e. Document Deployer) is used, while a QueryDB connection requires manual modification.
    • Should you wish to upgrade your DBXL version, and you have an EnumDB connection in your solution, the connection will not break since the web service still exists on newer DBXL versions. 
    The following steps demonstrate the use of EnumDB, particularly to query a specified column in a database table row. In this example, we will query a table with pre-submitted data as shown below: 

    1.      Design a blank InfoPath Form Template.

    2.      From the InfoPath menu, go to Tools > Data Connections.

    3.      Add a data connection that receives data from Database Enumeration Web Service, through the URL: http://<servername>/QdabraWebService/DatabaseEnumerationService.asmx, where <servername> is the name of the machine where DBXL is installed.

    4.      Select GetColumnsForRows from the list of operations. 

    5.      In this example, we will use the values for the parameters as specified below:

    6.      Enter the same values in the next screen.

    7.      Finish the Data Connection Wizard, making sure that the checkbox for Automatically retrieve data when form is opened is unchecked.

    8.      In the Design Tasks pane, click on Controls, and select Text Box.

    9.      Double-click on the text box field that was added onto the view to open the text box properties, and name the field Author.

    10.  Click on the fx button on the right-hand side of the Value field, and insert the field: /dfs:myFields/dfs:queryFields/tns:GetColumnsForRows/tns:filterCriteria/tns:string

    11.  Click OK until all the dialogs are closed.

    12.  Label the text box field as Author.

    13.  Add a button control underneath the Author field, and name it Query.

    14.  Add a rule on this button such that it executes query using the GetColumnsForRows data connection.

    15.  Add a drop-down list box control, and call it Name.

    16.  For the list-box entries, select the option to look up values from the external data source GetColumnsForRows. In the Entries field, select the Xpath /dfs:myFields/dfs:dataFields/tns:GetColumnsForRowsResponse/tns:GetColumnsForRowsResult/Rows/row/Name.

    17.  Click OK until all the dialogs are closed.

    18.  Click Preview to test the form. 

    Notice that the Author field is pre-populated with the value John Smith, as we specified in the data connection. Click on the Query button. 

    The drop-down control should then return a list of data (in this case, Book Names) for the Author specified.

    Change the Author to Jack Thomas, and click Query once again. You should then obtain results as shown below. 

    As you can see, EnumDB is very easy to use if the database table you are querying is small. However, when dealing with lots of data, QueryDB provides much more efficient options, as it allows you to retrieve only a subset of columns, and be able to filter and sort the results.
Copyright © 2003-2018 Qdabra Software. All rights reserved.
View our Terms of Use.