Format Custom Alert Message

I am alerting on pH and would like to format the pH value as 0.#. How can I format the {[VALUE]} in my custom alert message to 0.#? Right now I get things like pH High 7.78000020980835 when 7.8 would be sufficient.

Hi,

Unfortunately, right now the alert messages just do a straight substitution of the referenced value, and obviously it’s using the full string version of the float. I suppose that it should probably round the value, though better formatting control as part of the “language” might be useful.

I’ll put this in as a bug/feature request.

Regards,

This has been implemented for 7.2. You can now specify a format pattern (same as used in the numberFormat expression) for alert variables and tag references.

Here’s how it works:
Previously there were 2 types of references in alert messages- tag references, formatted like [tt]{path/to/tag}[/tt] and alert property references, denoted similarly, but with square brackets as well: [tt]{[propname]}[/tt].
Now you can add square brackets around tag paths as well. If you do that, you can add “|formatstring” in. For example:

{[path/to/tag|#0.00]}

and with properties, such as VALUE:

{[VALUE|#0.00]}

The extra square brackets around tag paths are used to tell the parser that there is likely going to be a format string. There doesn’t have to be, but it gives us the ability to use pipes in tag names in the future.

Regards,