=parameter(); function

Outline

The =parameter(); Scripting Engine function is a function that takes static or variable input and retrieves a selected parameter value or constructs a total parameter token based on input properties

Aliases

=parameter();
=param();

Properties

The parameter function has complex input:

 

Property Datatype Default value Description
id GUID [REQUIRED] The uniqueidentifier of the parameter.
This is a GUID-datatype reference to the parameter defined in BA DataCentral
alloutput String [ALL] This string controls which string is returned if the all-option is the current selected option for output types val and proc.
output String val

The type of parameter usage or output format:

val, total, proc, startperiod and endperiod are supported
 
prefix String and

Used with output = total only
and, or, where etc

colref String Column

Used with output = total only
myColumn etc

operator String =

Used with output = total only
=, <, >, <= etc

dateFormat String I
 
Used with periodic parameters only
 
I, U, CUSTOM
 
customDateFormat String ""
 
Used with periodic parameters only
MM, YYYY etc
 
period String Standard
 
Used with periodic parameters only
Standard, Trend
 
compIdx Integer -1
(all)
 
Used with composite key parameters only
-1 = whole node value
0 - n = composite part of node value
 
fallback String [OUTPUTERROR]
 
If any error is occurring during this parameter parsing the error message will be returned when fallback is set to [OUTPUTERROR].
If you want your own custom string or a empty string to be returned if the parameter parsing fails, you can provide this string with this property.
 

Examples

 

Given parameter ID = "233a028b-620a-4927-94f1-2aa7c36d862e" which is a period parameter and the following three expressions:
=param("id":"233a028b-620a-4927-94f1-2aa7c36d862e");
=param("id":"233a028b-620a-4927-94f1-2aa7c36d862e", "output": "total");
=param("id":"233a028b-620a-4927-94f1-2aa7c36d862e", "prefix": "or", "colref":"dateCol", "dateFormat": "I", "output": "total");
 
If selected value is the all-option, the output would be:
[ALL]
[empty-string] (blank)
[empty-string] (blank)
 
If selected value is year (This year), the output would be:
year
and column between ('2011-01-01 00:00:00' and '2011-12-31 23:59:59')
or dateCol between ('2011-01-01 00:00:00' and '2011-12-31 23:59:59')
 
Given parameter ID = "75ed8d1b-00bb-4859-9632-2ce314bee362" which is a ordinary data parameter and the following three expressions
=param("id":"75ed8d1b-00bb-4859-9632-2ce314bee362");
=param("id":"75ed8d1b-00bb-4859-9632-2ce314bee362", "colref":"newColumn", "operator": ">=", "output": "total");
=param("id":"75ed8d1b-00bb-4859-9632-2ce314bee362", "output": "proc");
 
If selected value is the all-option, the output would be:
[ALL]
[empty-string] (blank)
[ALL]
 
If selected value is 12, the output would be:
12
and newColumn >= 12
12
 
If the selected values are 12 and 16, the output would be:
12,16
and newColumn in (12,16)
'12|16'
 

Output property

 

There are currently four different output types available:
val
This type outputs only the selected option value(s).
If the alloption is the selected one "[ALL]" or [alloutput] is returned
 
total
This type outputs a complete parameter implementation to be used in for example a manual query. The different sections of the output is controlled by the according input parameters:
[prefix] [colref] [operator] [selectedOptionValue]
If multiple values are returned, the [operator]-property is ignored and a in-statement is created.
If the alloption is the selected, a empty string or [alloutput] is returned.
 
proc
This type outputs a parameter implementation dedicated to procedure input usage.
[prefix]/[colref]/[operator] is ignored.
If the alloption is the selected one "[ALL]" or [alloutput] is returned
 
startperiod
This type outputs only the startperiod date of a periodic parameter
 
endperiod
This type outputs only the startperiod date of a periodic parameter

 

prefix property

ATTN: This property is used in conjunction with output type set to total only!

The setting is a simple string that will be placed first in the condition line:

and columnA = 5

Default prefix is and, but you can set it to any string that would make your query syntax valid.

Often used prefixes are: or, where (attn: remember that this line is not rendered if all-option is selected!)

colref property

ATTN: This property is used in conjunction with output type set to total only!

The setting controls the name of the column which the parameter should reference

 

and columnA = 5

operator property

ATTN: This property is used in conjunction with output type set to total only!

This setting controls the operator of the expression.

 

and columnA = 5

dateFormat property

 

If the parameter is a period parameter, this property sets the date format to be returned:
I - ISO Date (YYYY-MM-DD hh:ss:mm)
U - UNIX Date (seconds since 1970-01-01)
CUSTOM - If [customDateFormat] is used this property needs to be set to "CUSTOM"

customDateFormat property

 

If the parameter is a period parameter and [dateFormat] is set to CUSTOM, this property lets you set a custom date format to be returned when ISO or UNIX format is not desired.
See .net date formatting for further details.

period property

 

If the parameter is a period parameter, this property controls if the standard period or the trend period should be returned.
Standard and Trend are valid values.
See timesheet documentation for further details.

compIdx property

 

If current parameter has a composite key this property lets you return only the desired index of the key of the selected option.
The selected value is split by the composite key seperator provided in the parameter definition and the zero based index of the resulting array is returned. eg: compIdx 0 is the first option