Pipe support in URL templates

As part of the template support, there is also support for adding a pipe “|” and an action to transform the replaced value. By default, all values are encoded with the JavaScript method encodeURIComponent. This is because the most common use case is to have a variable for a parameter value on an URL. By using the predefined syntax below a few transforming functions can be applied to the resulting value.

Not all actions support adding a parameter. There can only be one action specified.

Syntax: {variable| action:parameter}

Example: {inforCurrentLanguage | upper}

This returns EN-US in uppercase if the user has selected English (United States) as Language in User Settings > Localization Settings in Infor Ming.le.

The different actions are:

  • default
  • encode
  • upper
  • lower

The default and encode action can have a parameter.

Example: {company | default:120}

If the company variable is not found, it uses the company number 120 as the default value.

As these values are used in templates, any URL template automatically encodes the value. To avoid encoding you can set: {myparam | encode:none}

The valid parameters for the encode action are:

  • none - no encoding
  • uri - corresponds to the JavaScript method ‘encodeUri’ (to be used on path segments)
  • component - corresponds to the JavaScript method ‘encodeURIComponent’ and is for parameter values in a URL. This is the default action, and even if a lowercase action is added to a variable template the value will be encoded.