/
Parameters

Parameters

Parameters have been introduced in Perfion to allow for end user customization of reports and other outputs from Perfion. Parameter values can be set by the end user via the Report Dialog when running the report/generating the output.

Parameter Definition

  • Parameters are configured in the SuperQuery,

  • Parameters can also be supplied as Publication Settings

  • Parameters are available in both the report- and table-designer making it possible to customize both.

This page will walk through how incorporate parameters into your reports.

General syntax

Parameters are defined in a SuperQuery and affect the queries performed here (i.e. limit the number of rows etc.). The SuperQuery is defined in the Tools > Reports menu.

Parameters are added to the SuperQuery by making a child-element to the SuperQuery element named OutputParameters. This is done in the example below, note the standard report queries have been removed for brevity:

<SuperQuery execute=’ShowOptions’>     ...     <OutputParameters>       <Parameter id='Languages' input='Perfion.LookUp.Languages'>         <Value>EN</Value>         <Value>DE</Value>       </Parameter>       <Parameter id='VariantNaming' value='Enumerated' input='Perfion.LookUp.OutputNaming' />       <Parameter id='ImageResolution' value='Medium' input='Perfion.LookUp.ImageResolution' />       <Parameter id='MyDateParameter' input='Date' value='1971-07-27' />       <Parameter id='MyNumberParameter' input='Number' value='42' />       <Parameter id='MyStringParameter' input='String' value='This is a String' />       <Parameter id='MyTextParameter' input='Text' value='Finally a Text parameter' />       <Parameter id='MyFuelParameter' input='Fuel.String' value='Diesel' />       <Parameter id='MyMultiNumberParameter' input='Number' multi='true'>         <Value>1</Value>         <Value>2</Value>         <Value>3</Value>       </Parameter>       <!-- Below construct is first available in Perfion v 4.5.7 -->       <Parameter id='MyValue' value='My 2nd value'                  input='Perfion.LookUp.FromParameter(@AllMyValues)' />       <Parameter id='AllMyValues' hide='true'>         <Value>My 1st value</Value>         <Value>My 2nd value</Value>         <Value>My 3rd value</Value>       </Parameter>     </OutputParameters>   </SuperQuery>

The above SuperQuery will give an Output dialog as shown in the screenshot below.

A parameter element supports 5 attributes: id, input, value, hide and multi.

  1. The id attribute specifies the ID (which is also considered the name) of the parameter. The name may only contain English characters and digits, and may not begin with a digit. It is the same naming scheme that Perfion uses for features.

  2. The input attribute specifies what kind of GUI-control is used to show and edit the parameter. The value-attribute tell Perfion what the initial value of the parameter is. This value is reflected in the GUI control associated with each parameter, as can be seen when comparing the SuperQuery and the dialog above.
    Possible values for the input attribute on the parameter-element are:

    • Date: Will show a date picker allowing only input of valid dates (and blank). Date must either be a string formatted using YYYY-MM-DD or, from version 5.1, reference a system date variable like @@UTCNOW. Note that date parameters referencing system date variables supports simple calculations. See the Perfion API Query Reference Guide for further details on supported variables and calculations.

    • Number: Will show an edit box only allowing a number input (and blank).

    • String: Will show an edit box allowing any input.

    • Text: Will show a large edit box allowing any input.

    • <FeatureName>.String: Will show a selector, allowing the user to input any valid value for the feature named FeatureName assuming FeatureName is a String. This works only for selectable features.

    • <FeatureName>.Date: Same as for <FeatureName>.String except that it works for Date-features.

    • <FeatureName>.Number: Same as for <FeatureName>.String except that it works for Number-features.

    • <FeatureName>.Text: Same as for <FeatureName>. Text except that it works for Text-features.

    • <FeatureName>.Id: Same as above, except for that it will return the ID of the picked selectable, not the value it represents.

    • Perfion.LookUp.FilePath: This will allow the user to pick a file and pass the full path to this file into the parameter value as a string.

    • Perfion.LookUp.DirectoryPath: This will allow the user to pick a directory and pass the full path to this directory into the parameter value as a string.

    • Perfion.LookUp.Languages: This will allow the user to pick one or more languages.

    • Perfion.LookUp.Bool: This will show the user a checkbox allowing for quickly selecting between the values “true” and “false”.

    • Perfion.Lookup.ImageResolution: This will show a control allowing the user to pick between Original, Low, Medium, High or Custom resolution. It will return “Original”, “Low”, “Medium”, “High” and for “Custom” the associated DPI-value writable on the control.

    • Perfion.LookUp.OutputNaming: Will allow the user to select between values “Named” and “Enumerated”. Named means that localizable remotes are exported postfixed with the variant name. This is described in the appendix in the end of this document.

    • Perfion.LookUp.FromParameter(@<ParameterName>): This expression was introduced in Perfion 4.5.7. This makes it possible to create a parameter whose possible values can be supplied in another parameter. Looking at the example MyValue is such a parameter taking its value from the parameter named AllMyValues containing 3 values. Notice that AllMyValues cannot be seen in the above dialog. This is because it has the hide-attribute set to true as described below. When using this construct make sure the referred parameter exists, otherwise the control shows up empty.

  3. multi allows for entering multiple values for that parameter, as seen on the parameter MyMultiNumberParameter in the above example. The multi-attribute can only be used when input is either Date, Number, String, Text, Perfion.LookUp.Languages or Perfion.LookUp.FromParameter. If multi is not specified it is default set to false with the exception of Languages (which is a System Defined Parameter described later). In case Languages has two or more values (that is languages) assigned to it, multi will default be set to true otherwise it will be false.

  4. The attribute hide allows you to hide the parameter with its associated default value for the end user. In order to do that simply set hide to true on the Parameter-element as shown below. A parameter is shown by default except for the System Defined Parameters BinariesOnDemand and OutputBinaries.

<Parameter id='MyHiddenFuelParameter' input='Fuel.String' value='Diesel' hide='true' />

Globally Defined Parameters

Perfion has two sets of globally defined parameters, which are used to control different aspects of the generation of the output. The System defined Parameters controls aspects that affect all outputs (Reports, Excel-output, XML-output etc.) while the Output Specific Parameters control aspects that only affects a certain type of Output.

System Defined Parameters

The current set of System Defined Parameters are listed here:

  • ImageResolution

  • Languages

  • VariantNaming

  • BinariesOnDemand

Please see the SuperQuery Factsheet for a description of what each of these parameters mean. When showing the Output-dialog the System Defined Parameters will be shown on the Options-tab.

When clicking View or Design you will get a report, and as mentioned only the above System Defined Parameters affect the generation of that report.

Notice that in the example, we