Tuesday, June 8, 2010

Wabit finally supports Parameters!

In the last days SQL Power released Wabit 1.3.1, you can download it here: SQL Power Download Website.

The most important change that came with Wabit 1.3 is the ability to parametrize reports. Below is a screenshot on how it looks like:

Report with parameters in SQL Power Wabit
You can choose a text entry field, date picker and a select box as parameter entry field. The values from a select box can be based on a query.

How to add parameters to your report:
  • Add parameters to your SQL query. You can add parameters either by using the parameter dialog (Ctrl + Space) or just by using the right syntax in the query, for example "continent =${Continent->Europe}".
    • ${Continent} defines the parameters "Continent"
    • ${Continent->Europe} defines the parameter "Continent" and sets the default value to "Europe"
Parameter in a query
  • Create a new Report
    • Drag the query into the report
    • Add a parameter in the parameter panel (Go to View->Docked Source List if you can't see the parameter panel) . Make sure the parameter has the same name as you defined in the query.
      • To add a text entry field add a free form text.
      • To add a select box add a drop down list.
        • If you want to use values from a query in your select box, add a query with the values first and then select the query using "Source" and "Pick a variable" in the parameter properties.
      • To add a date picker add a date selection widget.
    • You will see that the result changes depending on the parameter entered.
Using a query as a select box

This functionality is available in the open source version of Wabit. Give it a try and let me know what you think of it.

    2 comments:

    EvilRabbit said...

    I've a question. I've previously worked with Crystal Reports, where I can get a subset of records by linking a sub report. However, I would very much like to know how to do the same in Wabit.

    You're using a region, and then displaying only the countries. Is this two different queries in one area?

    Benjamin said...

    I'm not sure if I really understand your question. With parameters you can create 1 query to get the list of possible parameters (ex. Continents). The selected continent (ex. Europe) can be used in the report (which is a second query) to only display countries from Europe.