Download Elixir Data Designer User Manual
Transcript
Dynamic Parameters
•
date(,"medium") // system locale, medium format
•
date(,"short") // system locale, short format
•
date(,"(yyyy) dd/MM") // system locale, custom format
•
date(fr,"short") // french locale, short format
As you can see, date can take up to two parameters (locale,format). Both parameters are optional.
The locale is defined using the appropriate language, country and variant codes, separated by
underscores: LA_CO_VA. Again you can omit values from the end to accept the default, LA_CO,
or just LA. The language codes are defined at: http://www.loc.gov/standards/iso639-2/englangn.html,
while the country codes are defined at: http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso3166-code-lists/list-en1.html. The format should either be "long","medium" or "short" or else a
custom pattern. Remember the format only affects how the date is presented to the user, not the
internal string representation of the date.
Dynamic parameters are always strings. This means the result substituted for a date type will not
be a date object, only a string representation (in ISO format, as mentioned earlier). If such a string
is substituted in JavaScript, you will be performing subtraction instead: 2005-01-01 = 2003! In
order to convert the string to a date, you need the following form of JavaScript (showing a french
date, here):
asDate("${Enter French date#date(fr,"long")}");
There are two important parts to this example. Firstly, notice that the ${} substitution is enclosed
within quotes. This ensures the result is substituted as a string, not as a series of number subtractions.
Secondly, the string is passed to the asDate() function, which is pre-defined within the tool for
converting strings in ISO date format into actual Date objects.
•
#lookup(...)# - Lookup choices from a datasource.
It is good to give users a choice of valid values, but the options are often dynamic. Using the lookup
type, you can fetch values from a datasource to populate a combo box on the parameter UI. Here's
an example:
${Company Name#lookup(Fruit,CompanyName)#B}
This will create a parameter on the UI with label Company Name with a combo box that reads its
values from the data source called Fruit using the field called "CompanyName". The default
selection will be company B.
Further, the datasource "Fruit" can be either:
•
The name of a Graphic Object within a Composite Diagram (Data Designer)
•
The name of a Data Source within a Report (Report Designer)
•
The name of a View using view: syntax (Dashboard Designer)
• The name of a datasource in the Repository (All)
Also, further parameters can be passed in if the datasource requires parameters:
${Company Name#lookup(Fruit,CompanyName,User=Jon,Password=XXX)#B}
Ordering Dynamic Parameters
By default, parameters are presented in alphabetical order. This means, if you have parameters defined
for ${Name} and ${Address} then the Address will appear first. Often we want to control the order
134