Background: Let’s make the DataGrid on the ListIssues view only show open issues. At the same time, let’s add a menu to filter the DataGrid by product.

Note: There’s quite a lot going on in this lesson, but if you follow the steps you’ll see how everything comes together.

  1. We’re creating a query that we’ll later hook up to the issues DataGrid on the ListIssues view.
  2. We’re configuring that query to only show open issues.
  3. We’re also configuring that query to only show issues for a specified product (by using a parameter).
  4. We’re then defining a parameter that we’ll later hook up to a product menu (Select widget) on the ListIssues view.
  5. We’re creating another query to populate that product menu.

Here we go…

Create Queries

  1. Go to the Queries option under Logic on the left-hand menu, add a new query, and name it OpenIssues.
  1. Move to the Parameters tab and add a new parameter named Product of type ID.
  1. Go back to the Query tab and Select records of model:issue.
  1. Skip Attributes and Pivots, and add Filter Criteria of
    • status ‘!= value:resolved AND
    • Product_id = parameter:Product
  2. Save your app.
  1. Add another query called AllProducts.
    • Select record of model:product
    • Order by name (ascending)
  2. Save your app.

Use your Queries

  1. Go to the web interface under the User Interface menu on the left-hand menu, and edit your ListIssue view.
  2. Double-click the DataGrid widget to edit it, and select your OpenIssues under the Query parameter.
  1. Add a Select widget to the view and configure it:
    • Connect To: Query-parameter: OpenIssues/Product
    • Data Query: AllProducts
  2. Rearrange your view to your liking.
  3. Save your app.

Test Drive

Launch your app and test the filter functionality provided by your new queries. The ListIssue view should only show non-Resolved issues, for the product that is selected.

Note: If your ListIssue view is blank, and you’re sure your queries are correctly configured, make sure you assigned a product to all of your issues, and that your issues aren’t all resolved. The query looks for non-resolved issues related to the selected product