Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Introduction

To apply number formatting to a dynamic variable, the 'format-number-hash' plugin Format Number Hash Plugin can be used. To do so, Nested hash variable formatting can be utilized to achieve number formatting with a dynamic variable when using the 'format-number-hash' pluginFormat Number Hash Plugin.


Using

...

Format Number Hash on Datalist

Similar to format-number-hash Format Number Hash for form #formatNumber.{form.table.field}[decimal=2], you can use a similar approach to formatting numbers retrieved from a datalist. When you have a hash variable that holds the sum or any numerical data from a datalist, you can format this number by placing it inside the format-number-hash syntaxFormat Number Hash syntax. This allows you to specify the desired number of decimal places or other formatting options.

for For example, if you have a sum of a datalist column being retrieved dynamically, you can add a thousand separators and decimals to it like so:

...

This will format your dynamic sum with two decimal places and include a comma as the thousand separator, see figure 2

Figure 2: number Number formatting on the sum of a datalist column

...

Format Number Hash on the

...

Arithmetic Operation

If you are performing arithmetic operations on data from datalists and wish to apply number formatting to the aggregated total, you can employ a nested expression hash variable. This would involve summing up the columns and then formatting the resulting total with the format-number-hashthe Format Number Hash. To learn more about using dynamic hash variable values within information tiles, please refer to the relevant documentation page use dynamic hash variable values inside information tiles 

...

Code Block
languagejava
#formatNumber.{exp.{envVariable.num1} + {envVariable.num2}}[decimal=2&thousandSeparator=,]#

for For example, if you have 4 datalists and you want to add the sum of columns and apply format-number-hash Format Number Hash on the total value, the format would be

...


Figure 3: Formatting the total value 

know Know more at at Hash Variable, under the Expression Hash Variable (New) section, on how to use different expressions.

Also, refer to the Format Number Hash Plugin, to learn how to format numbers.

Download Demo App

View file
nameAPP_kb_dx8_FormatNumberInHash.jwa
height250