You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Introduction

To apply number formatting to a dynamic variable, the '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' plugin.


Using format-number-hash on datalist

Similar to 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 syntax. This allows you to specify the desired number of decimal places or other formatting options.

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:

#formatNumber.{Your_datalist_hash}[decimal=2&thousandSeparator=,]#


For example, if there is a datalist named list_MoneyFlower, the hash variable will be

#formatNumber.{datalist.col.sum.list_MoneyFlower.column_1}[decimal=2&thousandSeparator=,]#

 

Figure 1: Datalist

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

Figure 2: 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-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 

 If you want to have the number formatted on the total value, The hash variable expression for that would be:

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

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

#formatNumber.{exp.{datalist.col.sum.list_Money_University.column_0} + {datalist.col.sum.list_Money_Resort.column_0} + {datalist.col.sum.list_Money_Hamburger_Shop.column_0} + {datalist.col.sum.list_MoneyFlower.column_1}}[decimal=2&thousandSeparator=,]#



Figure 3: Formatting the total value 

know more at Hash Variable, under Expression Hash Variable (New) section





  • No labels