Use Built-In Functions to Format Your Contextual Parameters

You can choose to use built-in functions to format the output of your contextual parameters.

For example, string keys can use the following format options:

  • ${machine.displayName?cap_first} converts the first letter of the string to uppercase.
  • ${machine.displayName?uncap_first} converts the first letter of the string to lowercase.
  • ${machine.displayName?capitalize} converts the string into title case (the first letter of every word is capitalized).
  • ${machine.displayName?lower_case} converts the string to lowercase.
  • ${machine.displayName?upper_case} converts the string to uppercase.
  • ${machine.displayName?remove_beginning("STRING")} removes the specified sub string from the beginning of the string.
  • ${machine.displayName?remove_ending("STRING")} removes the specified sub string from the end of the string.
  • ${machine.displayName?trim} removes any leading and trailing white spaces from the string.

The following examples describe some available format options for number outputs:

  • ${event.sensor.<sensor_name>?abs} converts a number to its absolute (non-negative) value.
  • ${event.sensor.<sensor_name>?c} converts a numeric value to the computer language value, as opposed to the default human readable format. Doesn't use grouping separators (commas, for example), uses dot as a decimal separator. Prints up to 16 digits after the dot. Never uses exponential form.
  • ${event.sensor.<sensor_name>?round} rounds the number to the nearest whole number. In case a decimal number ends with .5, rounds it to the next whole number.
  • ${event.sensor.<sensor_name>?floor} rounds the number downwards.
  • ${event.sensor.<sensor_name>?ceiling} rounds the number upwards.