How to display decimal value in the form input widget for whole number , I have taken variable type as text . I want when user type whole no it should get converted to decimal .
For ex. When I type text 500 then automatically it should convert to 500.00 .
Any help would be highly appreciated.
Hi Sangam,
To display decimal value in an Outsystems form input widget for whole numbers, you can use a custom action to format the input text. In the custom action, you can use the String.Format function to format the input text as a decimal number with two decimal places. Then you can bind the formatted text to the form input widget. Here's an example code:
var input = "500"; var formatted = String.Format("{0:0.00}", Convert.ToDecimal(input)); InputWidget.Text = formatted;
This code takes the input text and converts it to a decimal number using the Convert.ToDecimal function. Then, it formats the decimal number using the String.Format function with a format string of "{0:0.00}", which specifies two decimal places. Finally, it binds the formatted text to the form input widget.
Hi @Shubham Sharma , thanks for your answer , can you provide me an example in oml. It would be helpful for me.
Hi Sangam Bhondele,
I have attached an OML file for converting an integer to a decimal.
Regards,
Dhivyaraj
Hello Sangam ,
You can use the format decimal function available:
Hey @Sangam Bhondele
Simply just use the 2nd function shown in the image below in your assign function
Thanks
Shlok Agrawal.