Example - showing the currency name for each country

You want to create a query that shows the currency name for a specific country. To do this, you create a filter that returns data for a specific country code, and apply the filter to a model query subject that retrieves the currency name for each country.

The following example uses a relational data source.

Procedure

  1. Open the go_sales sample model. It is located in c10_location/webcontent/samples/Models/go_sales/go_sales.cpf
  2. Create a filter to limit the retrieval of data to only those country codes in the conversion rate table whose value is 2:
    • Click the Filters folder, and then click Actions, Create, Filter and name the new filter ConversionRateCountryCode.
    • Click the Model tab.
    • In the Available Components box, open the Database view folder and then open the GoSales folder.
    • Add the Country Code query item from Conversion Rate query subject to the Expression definition box, and type ='2' at the end of the expression.
    • Click OK.
  3. Create a model query subject named ISO Code.
    • In the Available Model Objects box, open the Database view folder.
    • Add Country query item and the ISO 3-letter code query item from the Country query subject to the Query Items and Calculations box.
  4. Apply the ConversionRateCountryCode filter:
    • Click the Filters tab.
    • Open the Filters folder and drag ConversionRateCountryCode to the Filters box.
  5. Click the Query Information tab.

    The generated SQL contains the filter even though it does not affect the result set.

  6. Change the usage of the ConversionRateCountryCode filter to Optional:
    • Click the Filters tab.
    • Click the ellipsis (...) button under Usage for the ConversionRateCountryCode filter, and click Optional.
  7. If you want to view the SQL, click the Query Information tab.
  8. Click OK.