To use Cognos product documentation, you must enable JavaScript in your browser.

Adding Business Rules

Information about business rules for SAP BW metadata appears in a different topic .

You can add business rules to the dimensions and query subjects in your model to refine the data retrieved and ensure that the correct information is available for your users.

Creating business rules and storing them in the model instead of in reports has many advantages. You save time because you and your users do not have to re-create the business rules every time they are needed. The business rules ensure consistency because your users all use the same definitions. For example, Low Margin means the same thing throughout the organization. They are easy to update because you maintain the business rules centrally so that all reports are updated automatically as the rules evolve. For example, if the definition for Low Margin changes, all reports that use the Low Margin calculation are updated automatically. The business rules enhance security. For example, you can use filters to limit the data that your users can see.

You can
      

add calculations so that your users can include calculated data in their reports

      

create and apply filters so that you limit the data that a query subject retrieves

      

add prompts that will automatically appear whenever a dimension or query subject is used in a report; report consumers are then prompted to filter data

      

use session parameters and parameter maps in macros to dynamically resolve expressions

      

create a security filter to control the data that is shown to your users when they set up their reports

Create a Calculation

Information about calculations for SAP BW metadata appears in a different topic .

You can create calculations to provide your users with calculated values that they regularly use. Calculations can use query items, parameters, variables, calculated members, expressions, and expression components, such as functions.

Punctuation characters, such as the question mark (?), must be in 7-bit ASCII character code. If you type a punctuation character from a multi-byte enabled keyboard, ensure that you type the 7-bit ASCII representation of the character. For example, type Alt+063 for the question mark.

Avoid using characters that are used for expression operators in the name of the calculation. Syntax errors may occur when the expression is evaluated. For example, a calculation named Margin * 10 causes errors when used in an expression such as [Margin * 10]< 20.

At query time, Framework Manager returns a null value for any calculation that contains a divisor whose value is zero. Framework Manager cannot detect zero-division errors in functions such as average and mod, because the division operator is not explicit.

Framework Manager supports stand-alone calculations and embedded calculations.

Steps
  1. Do one of the following:

  2. In the Name box, type a name for the calculation.

  3. Define the expression.

    Goal

    Action

    Add items

    On the Model tab, click a query item, filter, or calculation and click the arrow.

    Add functions

    On the Functions tab, choose a component and click the arrow.

    Add parameters

    On the Parameters tab, click a parameter and click the arrow.

    Retrieve all data and show a specified number of rows

    Click the options button, select the Restrict the maximum number of rows to be returned check box, and type the required number of rows to be returned.

     

    This setting does not improve performance for retrieving data when testing dimensions, query subjects, and query sets.

    Override session parameters

    Click the options button, click Set, enter a value in the Override Value field, and click OK.

     

    Override prompt values

    Click the options button, and then click Prompts.

     

    The Model Prompts Manager dialog box appears, which shows all prompts, and their values, that are in the model.

  4. To test the calculation, click the test button .

    You can test only calculations that contain query items. If a calculation contains a function, for example _add_days, the test sample button is not available.

  5. Click OK.

  6. Modify the Data Type property to identify the type of data the calculation returns.

    The Cognos 8 studio uses this information to format the data that the calculation returns.

You may be interested in the following related topics:

Create a Filter

Information about filters for SAP BW metadata appears in a different topic .

A filter is an expression that specifies the conditions that rows or instances must meet to be retrieved for the dimension, query subject, calculation, or report to which the filter is applied. A filter returns a boolean value so that you can limit the rows returned by a dimension or query subject.

For example, you can use the in_range function to create a filter that retrieves data for products introduced in a specific time frame. The syntax for this example looks like this:

[gosales_goretailers].[Products].[Introduction
date]
in_range {Feb 14, 1999 : July 14, 2007}

Note: When using a date or time function, you must use a 24-hour clock. Framework Manager does not support "a.m." or "p.m." in expressions. For example, use 20:00 to signify 8 p.m.

You can restrict the data represented by dimensions or query subjects in a project by creating a security filter. The security filter controls the data that your users can see when they set up their reports.

You can also apply governors to restrict the data that the queries in a package retrieve.

Framework Manager supports stand-alone filters and embedded filters.

Steps
  1. Do one of the following:

  2. In the Name box, type a name for the filter.

  3. Define the expression.

    Goal

    Action

    Add query items and filters

    On the Model tab, drag the objects you want to the Expression Definition box.

    Add functions

    On the Functions tab, drag the functions to the Expression Definition box.

    Add parameters

    On the Parameters tab, drag the parameters to the Expression Definition box.

    Retrieve all data and show a specified number of rows

    Click the options button, select the Restrict the maximum number of rows to be returned check box, and type the required number of rows to be returned.

     

    This setting does not improve performance for retrieving data when testing dimensions, query subjects, and query sets.

    Override session parameters

    Click the options button, click Set, enter a value in the Override Value field, and click OK.

     

    Override prompt values

    Click the options button, and then click Prompts.

     

    The Model Prompts Manager dialog box appears, which shows all prompts, and their values, that are in the model.

  4. To test the filter, click the test button .

  5. Click OK.

You can also apply governors to restrict the data that the queries in a package retrieve .

You may be interested in the following related topics:

Apply a Filter

Information about filters for SAP BW metadata appears in a different topic .

To apply a filter, you must modify the dimension, data source query subject, or model query subject. The query subject must either contain the query items that the filter references, or have a relationship path to the query subjects that contain the query items.

You can embed a stand-alone filter in dimensions or query subjects, but if you want a different usage for each embedded filter, you must create different versions of the stand-alone filter. Otherwise, your users could be required to fill in a prompt that you thought was optional if there is any instance where the usage is set to mandatory.

For example, in query subject A, you embed a stand-alone filter and define it as optional. In query subject B, you define it as mandatory. When your users create a report that uses both query subjects, they are required to choose values in both filters, even the one defined as optional. All instances of the filter are considered to be mandatory when used in the same query. The solution is to create different versions of the filter, each with its own name.

Steps
  1. Create a filter.

  2. Select the filter and, from the Actions menu, click Edit Definition.

  3. Click the Filters tab, and drag the filter you created to the Filters box.

  4. Select a usage value for the filter.

    Usage ValueDescription
    Always

    Use this usage value to ensure specified data is filtered out of all reports. For example, your company may have obsolete information that it stores but does not want to report on.

    Always is the default usage value.

    Design Mode Only

    Retrieves a small subset of the data for the sample report. Use this usage value when you do not need to see all the data, for example when testing a query subject.

    Your users may need the design mode filter in Query Studio when they want to focus on designing the layout and format of a report and not retrieve all the data as they work. To access the design mode filter in Query Studio, run the report with limited data.

    Optional

    Specifies that the filter is optional. The user is prompted to filter data and can leave the prompt blank. If the prompt is blank, Framework Manager ignores the filter and retrieves all data for the dimension or query subject.

    The ? ? syntax is required for optional prompts.

    Use this usage value if your users want to control when the filter is applied. For example, you want to see on one country sometimes and see the data for all countries at other times. An optional filter for country looks like this:

    ([GeoNamespace].[Countries].[CountryName] = ?WhichCountry?)

  5. If you want to view the SQL, click the Query Information tab.

  6. Click OK.

Example - Show 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.

Note: The following example uses a relational data source.

Steps
  1. Open the go_sales sample model. It is located in c8_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:

  3. Create a model query subject named ISO Code.

  4. Apply the ConversionRateCountryCode filter:

  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:

  7. If you want to view the SQL, click the Query Information tab.

  8. Click OK.

Create a Parameter Map

Information about parameter maps for SAP BW metadata appears in a different topic .

Use parameters to create conditional query subjects that allow for substitutions when the report is run. Parameter maps are objects that store key-value pairs. Parameter maps are similar to data source look-up tables. Each parameter map has two columns, one for the key and one for the value that the key represents. You can manually enter the keys and values, import them from a file, or base them on existing query items in the model.

All parameter map keys must be unique so that Framework Manager can consistently retrieve the correct value. Do not place quotation marks around a parameter value. You can use quotation marks in the expression in which you use the parameter.

The value of a parameter can be another parameter. However, you must enclose the entire value in number signs (#). The limit when nesting parameters as values is five levels.

When you use a parameter map as an argument to a function, you must use a percentage sign (%) instead of a dollar sign ($).

We recommend that you assign an alias to a query item that uses a parameter map as part of its name and to add the multilingual names to the object in the Language tab (Properties pane).

Constraint

We recommend that you do not base a parameter map on a query item or table with a large result set, such as 50,000 rows. Each time you use the parameter map in an expression or in SQL, Framework Manager executes this large query. Performance is then slowed. Parameter maps are recommended for smaller lookup tables.

Steps to Manually Create a Parameter Map
  1. Click the Parameter Maps folder and, from the Actions menu, click Create, Parameter Map.

  2. In the Name box, type a name for the new parameter map.

  3. Click Manually enter the parameter keys, and/or import them from a file and click Next.

  4. Do one of the following:

    Note: If you are going to use a parameter in a data source query subject, the value must use English-specific punctuation. This means that you must use a period (.) to represent a decimal and a comma (,) to separate lists of values.

  5. Modify existing parameters as required.

    Goal

    Action

    Assign a default value

    In the Default Value box, type a value.

    If the key is used in an expression that is not mapped, the default value is used.

    Remove a parameter

    Select a row and click Delete.

    Modify a parameter

    Select the row you want to modify, click the Edit button, and type a value.

    Clear all keys and values

    Click Clear Map.

  6. Click Finish.

Steps to Base a Parameter Map on Existing Query Items
  1. Click the Parameter Maps folder and, from the Actions menu, click Create, Parameter Map.

  2. In the Name box, type a name for the new parameter map.

  3. Click Base the parameter map on existing Query Items and click Next.

  4. Click the query item to use as the key, and then click the query item to use as the value.

    Both query items must be from the same query subject.

  5. Click Next.

    You can assign a default value. If the key used in an expression is not mapped, the default value is used.

  6. Click Finish.

You may be interested in the following related topics:

Example - Specifying a Language Value for Relational Metadata

An international company stores its product information in English and French. With the use of a parameter map and macros, employees can retrieve data that matches the information they require.

Create a Language_lookup parameter map that contains the following:

Key

Value

en

EN

fr

FR

When you examine the SQL for the Product Line query subject, you see the following:

Select 
	PRODUCT_LINE.PRODUCT_LINE_CODE,
	#'PRODUCT_LINE.PRODUCT_LINE_' + $Language_lookup{$runLocale}#
as Product_Line
from 
	[gosales].PRODUCT_LINE PRODUCT_LINE

The runLocale macro returns a locale setting that is used by the Language_lookup macro to specify a language value.

Create a Session Parameter

Information about session parameters for SAP BW metadata appears in a different topic .

A session parameter is a variable that Framework Manager associates with a session. For example, user ID and preferred language are both session parameters. Because session parameters are key and value pairs, you can think of each session parameter as an entry in a parameter map named Session Parameters. You use a session parameter in the same way that you use a parameter map entry, although the syntax for session parameters is slightly different.

There are two types of session parameters: environment and model.

Environment session parameters are predefined and stored in Content Manager. By default, the following session parameters appear in Framework Manager:

If you log on anonymously, you will see only runLocale and account.defaultName(Anonymous).

If your authentication source supports other parameters and you entered information about them in the authentication source, you see other session parameters, such as account.personalInfo.email.

You can define additional parameters by using model session parameters. Model session parameters are stored in a parameter map named _env. They are set in the project and can be published with a package.

Model session parameters must have their values set within the scope of objects in the Framework Manager model. The scope can include the use of existing environment session parameters, as well as static values.

Each session parameter must have a name and a default value. You can define an override value to test the results that value returns. The override value is valid only when you have the model open, and is not saved when you save the model. If no override value exists, Framework Manager uses the default value when it executes a query that contains a session parameter.

The rules governing the use of parameters include the following:

Steps
  1. From the Project menu, click Session Parameters.

  2. Click New Key and type a session parameter key and value.

  3. Choose how to handle the override value.

  4. Modify existing parameters as required.

    Goal

    Action

    Change the parameter value

    Click the row that contains the value you want to change, click Edit, and type a value.

    Assign a default value

    In the Default Value box, type a value. Framework Manager uses the default value if a key has an invalid value.

    Remove a parameter

    Click a row and click the Delete button. You cannot delete an environment session parameter.

    Clear an override value

    Click a row and click Clear Override.

  5. Click Finish.

Using Parameters with Relational Data Source Query Subjects

Model objects do not reflect changes to the data source objects on which they are based. Therefore, when you add a parameter to a data source query subject, consider whether you want to create a model object that references the parameter. If so, you must assign an alias to the parameterized object in the data source query subject. This ensures that model query subjects, filters, or calculations that reference the object return the correct results when the parameter value changes.

For example, the following SQL defines a data source query subject that contains a session parameter named runLocale. The runLocale parameter value specifies which column the query retrieves. The alias behaves like a shortcut so that when a model object references CountryNameAlias, Framework Manager retrieves the value to which the alias is assigned.

Select
	#$ColumnMap{$runLocale}# as
CountryNameAlias
From
	[GoSales].Country

Creating Prompts with Query Macros

Macros are fragments of code that you can insert anywhere in the Select statement that defines a query subject. You can include references to session parameters, parameter maps, and parameter map entries. Parameter values are set when you run the query.

For example, you can use the language session parameter to show only the data that matches the language setting for the current user.

Macros can be used in these different ways:

You can replace the following query subject elements with a parameter.

Element

Example

Query items identified in the Select list

#'Product_name_'+ $languageCode#

Tables identified in the From clause

Product_#$language#

Where clause

Product_lang = #sq($languageCode)#

Name of the data source, schema, or source property

#$data_source#.#$schema#.Products

Syntax

Use the following syntax to reference session parameter and parameter values.

Object

Syntax

Example

Session key

$session_key

#$my_account#

Parameter map key

$map{<key>}

#$map_one{'abc'}#

Parameter map entry whose key is defined by a session parameter

$map{$session_key}

#$map_one{$my_account}#

You can add the following elements to further define the macro expression.

Symbol

Purpose

Single quotation marks '

Delineates a literal string that has a single quotation mark as part of the string.

If the single quotation mark appears in a string, such as a query item, the string must be enclosed in a single quotation mark on both sides of the string and the single quotation mark must be doubled. For example, ab'c is written as 'ab''c'

If the single quotation mark appears in a macro, the string must be enclosed in square brackets. For example, ab'c is written as [ab'c]

If the single quotation mark appears in a prompt, there is no need to enclose the string.

To escape a single quotation mark in an expression, use &apos;

Square brackets [ ]

Encloses model objects, such as a namespace or query subject and macro names that contain restricted characters, such as a number sign, hyphen, or space.

Curly brackets, also known as braces { }

Calls a function that is unknown to the parser, such as dateadd in DB2, and whose first argument is a keyword.

Example:

dateadd ({month},2,<date
expression>)

+ operator

Concatenates two strings, such as 'abc' + 'xyz'

Single quote function (sq)

Surrounds the result of a string expression with single quotation marks. Existing single quotation marks are double-escaped so that they do not interfere with the quotation structure. You can use this function to build clauses to test against literal parameter-driven values.

Here is an example:

#sq($my_sp)#

If a session parameter (my_sp) has the value ab'cc, the result is

'ab"cc'

Double quote function (dq)

Surrounds the result of a string expression with double quotation marks. You can use this function to refer to table and column names with non-identifier characters, such as a blank space or a percent sign (%).

Here is an example:

#dq
('Column' + $runLocale)#

If runLocale=en-us, the result is

"Column en-us"

Square bracket function (sb)

Inserts a set of square brackets into the argument to build object references in a model query and model expressions, such as filters and calculations.

Here is an example:

#sb
('my item in ' + $runLocale)#

If runLocale=en-us, the result is

[my item in en-us]

For information about functions, see Using the Expression Editor.

Create a Macro

Macros are fragments of code that you can insert anywhere in the Select statement that defines a query subject. You can include references to session parameters, parameter maps, and parameter map entries. Parameter values are set when you run the query.

Constraints

When you reference a parameter, you must do the following:

Do not insert macros between existing quotation marks or square brackets because Framework Manager does not execute anything within these elements.

Steps
  1. Select the data source query subject you want to modify.

  2. From the Actions menu, click Edit Definition.

  3. On the SQL tab, click Insert Macro to start the Macro Editor.

  4. In the Available components box, click the parameter maps, session parameters, or functions you want to use, and drag them to the Macro definition box.

    Ensure that you type the macro expression between the number signs. If you enter text before or after the number signs, when you click OK, Framework Manager deletes this text.

  5. Insert single or double quotation mark functions.

    Tip: Click the arrow next to these buttons for a menu of choices for placing the quotation marks .

  6. If you want to edit a parameter map or session parameter, click it in the Macro definition box.

    The Parameter Map or Session Parameters dialog box appears. You can set override values for session parameters, add new items, or change values.

  7. Check the macro in the Information box.

    If a macro is incorrect, an error message appears.

    Tip: To clear a macro, click the clear all button .

  8. Click OK.

Mandatory and Optional Prompts

You can create mandatory and optional prompts in Framework Manager models by using query macros. You can use two prompt macro functions, prompt and promptmany, to create single value prompts and multiple value prompts. You can insert a prompt macro anywhere in the SQL statement that defines the query subject.

If you want to use a prompt macro in an expression such as a calculation, you must specify the data type when using an overloaded operator, such as a plus sign (+). You can use the plus sign to concatenate two items and to add two items.

If you want to define a filter on a dimension level and have the filter use the prompt or promptmany macro, you must provide the data type as memberuniquename and a default value. Here is an example:

members( [MS_gosales].[New Dimension].[PRODUCTLINE].[PRODUCTLINE]
)  in ( set( #promptmany('what', 'memberuniquename', '[MS_gosales].[PROD1].[PRODUCTLINE].[PRODUCTLINE]->[all].[1]'
)# ) )

Here is an example of a mandatory prompt:

select 
	COUNTRY_MULTILINGUAL.COUNTRY_CODE as COUNTRY_CODE,
	COUNTRY_MULTILINGUAL.COUNTRY as COUNTRY,
	COUNTRY_MULTILINGUAL."LANGUAGE" as LANGUAGE1,
	COUNTRY_MULTILINGUAL.CURRENCY_NAME as CURRENCY_NAME 
from 
	gosales.gosales.dbo.COUNTRY_MULTILINGUAL COUNTRY_MULTILINGUAL
where COUNTRY_MULTILINGUAL.COUNTRY = #prompt('CountryName')#

The prompt and promptmany functions have the following parameters. All argument values must be specified as strings.

Parameter

Description

Name

(mandatory)

Name of the prompt. Can also refer to the name of a parameter on a user-created prompt page, in which case the user-created prompt page appears when the report is run instead of the default prompt page that the macro would generate.

Datatype

(optional)

Prompt value data type. The default value is string. Prompt values are validated. In the case of strings, the provided value is enclosed in single quotation marks and embedded single quotation marks are doubled.

 

Values include:

  • boolean

  • date

  • datetime

  • decimal

  • double

  • float

  • int

  • integer

  • interval

  • long

  • memberuniquename -- Memberuniquename is not an actual data type. Use it in cases when the data type of the parameter is a member unique name (MUN). For example, use the syntax #prompt('Parameter', 'memberuniquename')#.

  • numeric

  • real

  • short

  • string

  • time

  • timeinterval

  • timestamp

  • token -- Token is not an actual data type. It is a way to pass SQL. A token does not pass values.

  • xsddate

  • xsddatetime

  • xsddecimal

  • xsddouble

  • xsdduration

  • xsdfloat

  • xsdint

  • xsdlong

  • xsdshort

  • xsdstring

  • xsdtime

DefaultText

(optional)

Text to be used by default. If a value is specified, the prompt is optional.

If you use a space and no values are provided in the Prompt Value dialog box, a Where clause is usually not generated.

If you use text and no values are provided in the Prompt Value dialog box, a Where clause is usually generated using the default value.

Ensure that the text you provide results in a valid SQL statement.

Text

(optional)

Text that precedes any user-provided values, such as, 'and column1 = '.

QueryItem

(optional)

The prompt engine can take advantage of the Prompt Info properties of the query item. Descriptive information can be shown although the prompt value is a code.

TextFollowing

(optional)

The closing parenthesis which is used most often for the promptmany function. It is also useful when the prompt is optional and is followed by hardcoded filters in the SQL statement.

Examples - Select a Country Prompt

When a report is run, you want your users to be prompted to choose the country for which they want to see data. The following code examples describe how you can use macros to create different prompts.

Mandatory Prompt with No Data Type Specified

Note the following:

select 
	COUNTRY_MULTILINGUAL.COUNTRY_CODE as COUNTRY_CODE,
	COUNTRY_MULTILINGUAL.COUNTRY as COUNTRY,
	COUNTRY_MULTILINGUAL."LANGUAGE" as LANGUAGE1,
	COUNTRY_MULTILINGUAL.CURRENCY_NAME as CURRENCY_NAME 
from 
	gosales.gosales.dbo.COUNTRY_MULTILINGUAL COUNTRY_MULTILINGUAL
where COUNTRY_MULTILINGUAL.COUNTRY = #prompt('CountryName')#
Mandatory Prompt with the Data Type Specified

Note the following:

select 
	COUNTRY_MULTILINGUAL.COUNTRY_CODE as COUNTRY_CODE,
	COUNTRY_MULTILINGUAL.COUNTRY as COUNTRY,
	COUNTRY_MULTILINGUAL."LANGUAGE" as LANGUAGE1,
	COUNTRY_MULTILINGUAL.CURRENCY_NAME as CURRENCY_NAME 
from 
	gosales.gosales.dbo.COUNTRY_MULTILINGUAL COUNTRY_MULTILINGUAL
where COUNTRY_MULTILINGUAL.COUNTRY_CODE > 
	#prompt('Starting CountryCode',
			'integer',
			'',
			'',
	'[gosales].[COUNTRY_MULTILINGUAL].[COUNTRY_CODE]')#
Optional Prompt and Mandatory Filter with the Data Type and Default Value Specified

Note the following:

select
	COUNTRY_MULTILINGUAL.COUNTRY_CODE as COUNTRY_CODE,
	COUNTRY_MULTILINGUAL.COUNTRY as COUNTRY,
	COUNTRY_MULTILINGUAL."LANGUAGE" as LANGUAGE1,
	COUNTRY_MULTILINGUAL.CURRENCY_NAME as CURRENCY_NAME 
from 
	gosales.gosales.dbo.COUNTRY_MULTILINGUAL COUNTRY_MULTILINGUAL
where COUNTRY_MULTILINGUAL.COUNTRY_CODE > 
#prompt('Starting CountryCode',
			'integer',
			'10'
)#
Prompt That Appends Text to the Value

Note the following:

select 
	COUNTRY_MULTILINGUAL.COUNTRY_CODE as COUNTRY_CODE,
	COUNTRY_MULTILINGUAL.COUNTRY as COUNTRY,
	COUNTRY_MULTILINGUAL."LANGUAGE" as LANGUAGE1,
	COUNTRY_MULTILINGUAL.CURRENCY_NAME as CURRENCY_NAME 
from 
	gosales.gosales.dbo.COUNTRY_MULTILINGUAL COUNTRY_MULTILINGUAL
#prompt('Starting CountryCode',
		'integer',
		' ',          // < = = this is a space
	'where COUNTRY_MULTILINGUAL.COUNTRY_CODE >'
)#
Syntax Substitution

Note the following:

Select 
	COUNTRY_MULTILINGUAL.COUNTRY_CODE as COUNTRY_CODE,
	COUNTRY_MULTILINGUAL.COUNTRY as COUNTRY,
	COUNTRY_MULTILINGUAL."LANGUAGE" as LANGUAGE1,
	COUNTRY_MULTILINGUAL.CURRENCY_NAME as CURRENCY_NAME 
from 
	gosales.gosales.dbo.COUNTRY_MULTILINGUAL COUNTRY_MULTILINGUAL	
#prompt('Sort column',
			'token',
			'group by COUNTRY',
	'group by '
)#

Examples - Create a Prompt That Uses a Parameter Map

When a report is run, you want your users to select a language for the data in the report. The following examples describe several ways you can do this.

Prompt That Uses a Session Variable

Note the following:

select 
	ORDER_METHOD.ORDER_METHOD_CODE as ORDER_METHOD_CODE,
	ORDER_METHOD.ORDER_METHOD_#$language#
	as ORDER_METHOD_EN 
from 
	gosales.gosales.dbo.ORDER_METHOD ORDER_METHOD
#prompt($PromptLabels{$language},
	'',
	' ',
	'where ORDER_METHOD.ORDER_METHOD_' + $language + '
>'
)#
A Parameter Map That Nests Prompts

Note the following:

select 
	ORDER_METHOD.ORDER_METHOD_CODE as ORDER_METHOD_CODE,
	ORDER_METHOD.ORDER_METHOD_#$language#
	as ORDER_METHOD_EN 
from 
	gosales.gosales.dbo.ORDER_METHOD ORDER_METHOD
#prompt($DynPromptLabels{'ex9'},
	'',
	' ',
	'where ORDER_METHOD.ORDER_METHOD_' + $language + '
>'
)#

Examples - Create a Multiple Value Prompt

When a report is run, you want your users to select one or more values. The following examples describe several ways you can do this.

Prompt with a Required Minimum

Note the following:

select
	COUNTRY_MULTILINGUAL.COUNTRY_CODE as COUNTRY_CODE,
	COUNTRY_MULTILINGUAL.COUNTRY as COUNTRY,
	COUNTRY_MULTILINGUAL."LANGUAGE" as LANGUAGE1,
	COUNTRY_MULTILINGUAL.CURRENCY_NAME as CURRENCY_NAME 
from 
	gosales.gosales.dbo.COUNTRY_MULTILINGUAL COUNTRY_MULTILINGUAL
where COUNTRY_MULTILINGUAL.COUNTRY IN (#promptmany('CountryName')#)
Prompt with a Required Minimum with the Data Type Specified

Note the following:

select 
	COUNTRY_MULTILINGUAL.COUNTRY_CODE as COUNTRY_CODE,
	COUNTRY_MULTILINGUAL.COUNTRY as COUNTRY,
	COUNTRY_MULTILINGUAL."LANGUAGE" as LANGUAGE1,
	COUNTRY_MULTILINGUAL.CURRENCY_NAME as CURRENCY_NAME
from
	gosales.gosales.dbo.COUNTRY_MULTILINGUAL COUNTRY_MULTILINGUAL
where COUNTRY_MULTILINGUAL.COUNTRY_CODE   IN (
	#promptmany('Selected CountryCodes',
					'integer',
					'',
					'',
					'[gosales].[COUNTRY_MULTILINGUAL].[COUNTRY_CODE]')#
)
Optional Prompt with the Data Type and Default Value Specified

Note the following:

select 
	COUNTRY_MULTILINGUAL.COUNTRY_CODE as COUNTRY_CODE,
	COUNTRY_MULTILINGUAL.COUNTRY as COUNTRY,
	COUNTRY_MULTILINGUAL."LANGUAGE" as LANGUAGE1,
	COUNTRY_MULTILINGUAL.CURRENCY_NAME as CURRENCY_NAME
from
	gosales.gosales.dbo.COUNTRY_MULTILINGUAL COUNTRY_MULTILINGUAL
where COUNTRY_MULTILINGUAL.COUNTRY_CODE IN (
	#promptmany('Selected CountryCodes',
					'integer',
					'10'
	)#
)
Prompt That Adds Text Before the Syntax

Note the following:

select
	COUNTRY_MULTILINGUAL.COUNTRY_CODE as COUNTRY_CODE,
	COUNTRY_MULTILINGUAL.COUNTRY as COUNTRY,
	COUNTRY_MULTILINGUAL."LANGUAGE" as LANGUAGE1,
	COUNTRY_MULTILINGUAL.CURRENCY_NAME as CURRENCY_NAME
from
	gosales.gosales.dbo.COUNTRY_MULTILINGUAL COUNTRY_MULTILINGUAL
#promptmany('Selected CountryCodes',
				'integer',
				' ',     // < = = this
is a space
				'where COUNTRY_MULTILINGUAL.COUNTRY_CODE IN
( ',
				'',
				')'
)#
Optional Prompt That Adds Text Before the Syntax
Select 
	COUNTRY_MULTILINGUAL.COUNTRY_CODE as COUNTRY_CODE,
	COUNTRY_MULTILINGUAL.COUNTRY as COUNTRY,
	COUNTRY_MULTILINGUAL."LANGUAGE" as LANGUAGE1,
	COUNTRY_MULTILINGUAL.CURRENCY_NAME as CURRENCY_NAME 
from 
	gosales.gosales.dbo.COUNTRY_MULTILINGUAL COUNTRY_MULTILINGUAL,
	gosales.gosales.dbo.COUNTRY XX
where COUNTRY_MULTILINGUAL.COUNTRY_CODE = XX.COUNTRY_CODE
	#promptmany('Selected CountryCodes',
					'integer',
					' ',
		' and COUNTRY_MULTILINGUAL.COUNTRY_CODE IN (',
					'',
					')'
	)#