Converts a numeric value to a string.
Returns
A string that is the result of unparsing the numeric argument with the
numberFormat argument.
Remarks
formatnumber() is limited to client-side queries, which means that it does
not work with arguments that are the direct results of a server-side query. When you need to
stringify an integer or float that you query from a reference table on the server, a
workaround is to store the result of the server-side query in a let helper
variable on the client-side, and then run formatnumber() on the variable. Best practice though is to use the
tostring() function as it works both on the server-side and the
client-side.
The sample below has two table controls that query the same reference table.
The first one uses the tostring() function to convert the integer query
result to a string. The second one uses formatnumber() to attempt to do the same - this part
of the sample code would fail at compile-time if you uncommented it.
To be able to run the server-side query to a reference table in the example below, you'll need the declaration file and some input data for the reference table that the code sample queries.
<table label="This control uses the TOSTRING()
function to format the result
of its server-side reference table query"
id="tableGdoo"
recordset='{SELECT TOSTRING(k.numint) v
FROM nufDtl k}'
record="gdoo">
<row>
<cell>
<textview text='{gdoo.v}'/>
</cell>
</row>
</table>
<!--This would throw an error at compile time
because the query attempts to run a client-side function
on a server-side reference table query
<table id="tableHku"
recordset='{SELECT FORMATNUMBER(k.numint,{decimalSeparator:".",groupSize:3,groupSeparator:" "}) v
FROM nufDtl k}'
record="hku">
<row>
<cell>
<textview text='{hku.v}'/>
</cell>
</row>
</table>-->
Sample
...
<numberbox id="numberNumber"
label="Enter your number"
float="true"
numberFormat='{decimalSeparator:"."}'/>
<textview label="Your number in the Zarblaxian format"
text='{FORMATNUMBER(numberNumber.number,
{decimalSeparator:"ß", groupSize:2, groupSeparator:"%"})}'/>
<textview label="Your number in the Elbonian format"
text='{FORMATNUMBER(numberNumber.number,
{decimalSeparator:"*", groupSize:1, groupSeparator:"@"})}'/>
...

