Issue with Displaying Decimal Field Value in Label on Freedom UI Page
I am looking for assistance with a challenge I am facing in the Freedom UI of Creatio regarding the display of decimal field values in a label.
The issue I am encountering is that when I try to display a decimal value in a label on the Freedom UI page, the value is not being comma-separated as expected. For example, if the decimal value is 23,586.06, the label only shows 23586.06 without the comma. Similarly, for the value 1,000.00, the label displays only 1000 instead of 1,000.00.
What I am aiming for is to have the decimal values displayed with commas for better readability. For instance, the value 23,586.06 should be displayed as 23.586.06, and 1,000.00 should appear as 1,000.00 in the label on the Freedom UI page.
I have tried several approaches to address this issue within the Freedom UI but have not been successful in achieving the desired result.
Like
When you set the number in the attribute bound to the label you can use toLocaleString:
request.$context.MyAttribute = num.toLocaleString();
Ryan
Hello ,
Thanks for the response.
The below given code is how we are currently setting the value of the UsrAmount decimal field to be shown as a label caption.
{
"operation": "insert",
"name": "Label_td5mlo3",
"values": {
"layoutConfig": {
"column": 1,
"row": 2,
"colSpan": 1,
"rowSpan": 1
},
"type": "crt.Label",
"caption": "$PDS_UsrAmount_7hu2ut1",
"labelType": "headline-1",
"labelThickness": "bold",
"labelEllipsis": false,
"labelColor": "#181818",
"labelBackgroundColor": "transparent",
"labelTextAlign": "center",
"visible": true
},
"parentName": "GridContainer_rpq3gxq",
"propertyName": "items",
"index": 1
}
As a result, it picks the value from the decimal field and shows in the label as shown in the screenshot below:
I want to show the Label caption in the same format as that of the amount field. Also another thing that we have noticed is that when the amount is 1,000.00 , the caption shows 1000 instead of 1000.00.
kindly help