|Home | Products | Issue Tracker | FAQ | Download|
|Contact:||steve.lime at DNR.STATE.MN.US|
Description: A the moment processing of attributes exposed via query templates is limited to a couple forms of escaping. This is too limiting. It would be much nicer to be able to apply a format to an attribute (e.g. truncate decimals or add a prefix) or detect when it is NULL or empty and present an alternative representation. This RFC describes a simple scheme to allow for extended processing of attributes before sending to the a users.
This would involve adding a new “item” tag to the template processor.
N/A, new functionality. Existing methods for exposing an attribute (e.g. [attribute name] would continue to function, although we might mark that as deprecated at some point.
The “item” tag would have the following properties.
We could add simple case statement support at a later date but the above would more than meet my needs at the moment.
Display no decimal places, and commify:
[item name=foo commity=true precision=0] - 12345.6789 output as 12,345
Conditional display an item if its value contains ‘bar’:
[item name=foo pattern=bar]
Escape a value for inclusion in a URL, and convert to upper case:
[item name=foo uc=true escape=url] - “hello world” output as “HELLO%20WORLD”
Apply a custom format to an item, and display a message if the item is empty:
[item name=foo format=”foo=$value” nullformat=”foo is not found”]
Item tags are processed after other column tags (e.g. [foo]) so you can include substitution strings within the item tag itself.
+1: Lime, Morissette, Butler +0: Gillies, Warmerdam