Manually Defining and Editing Object Queries

Add, edit, and delete object queries, including the FindAll object query for an existing mobile business object (MBO) from the Properties view.

Define, or modify, object query properties used to implement the object query.

  1. From the Mobile Application Diagram, right-click the MBO for which you are configuring an object query and select Show Properties View. Or double-click the MBO title compartment (not on the title) to open the Properties view.
  2. In the Properties view, select the Attributes tab located on the left side, then select the Object Queries tab located on the top.
  3. To create a new object query, select Add. Follow the wizard instructions to create and add the object query. These properties can be modified later by selecting Edit, or by selecting their corresponding check boxes from the Properties view:
    • Name – identifies the query.
    • Comment – an optional description of the object query.
    • Parameters – any additional parameters used to modify the object query. Use the Add, Delete/Delete All, Up, and Down buttons to create, remove, or rearrange the parameters.
    • Generate – generates a query based on the defined parameters, which can be edited as required. A parameter must map to an available attribute to be generated, but the Generate button is enabled even if there are no parameters. In this case clicking Generate creates a template from which you can fill in your own definition.
    • Query definition – the SQL statement that defines the query.
    • Create an index – generates a composite non-unique index for all mapped attributes.
    • Return type – select either:
      • Return a single object – to return a single object (one row).
      • Return multiple objects – the default option unless a result set is detected. Indicates the object query can return more than one object.
      • Return a result set – Unwired WorkSpace parses the query definition. If a JOIN operation is specified, no matter which return type option is selected, the return type is changed to Return a result set and an information dialog notifies you of this change when you click OK. You can then select any of these three options.
  4. (Optional) Select Generate FindAll query – returns a complete list of MBO data values. For example, use the FindAll query in your device application to get all customers from the Customers MBO. The client code could be:
    CustomerList customers = Customer.FindAll();
    
    or
    List<Customer> customers = Customer.FindAll(); 

    This option is selected by default, and also generates the isGenerateFindAllQuery() method which returns a boolean, indicating that the FindAll query was generated for normal and local MBOs, and always returns true for structure MBOs. Unselect this option for child MBOs in composite relationships.

  5. Click Finish.