Is it possible to take the text as a field value by code?
No. The text
parameter of the setFormat function only changes how the value is displayed in the field and does not change the value itself.
How can I format numbers using text?
All negative values are represented as (1 000.00)
:
f1=: setFormat(condition: $#nfv < 0; text: $text)
text: strAdd(str: "("; str: $numform; str: ")")
numform: numFormat(num: $mod; decsep: ","; thousandssep: " ")
mod: modul(num: $#nfv)
How can I format numbers with prefix, postfix, and divider parameters?
For fields of type Number
, there are parameters that define formatting:
All subsequent child parameters to Currency
override it if filled:
For these parameters, you can specify different values for positive and negative numbers using the separator **
— to the left of the separator for positive, to the right for negative.
Example of using text to calculate dynamic information
Sometimes it is necessary to display the sum in the footer field taking into account the prefilter.
If you simply do:
=: listSum(list: $list)
list: selectList(table: $#ntn; field: 'field')
Then the sum will not change depending on the selected prefilter. But writing a reference to the prefilter in the where
clause in the code would be fundamentally incorrect!
Therefore, the Code remains empty, and everything is written in the formatting:
f1=: setFormat(text: $sum)
sum: listSum(list: $list)
list: selectList(table: $#ntn; field: 'field'; where: 'connect' = #fl_connect)