508
Views
5
Comments
Input widget integer to decimal
Question

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.

2025-08-13 09-41-37
Shubham Sharma
Champion

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. 

2023-01-03 18-53-09
Sangam Bhondele

Hi @Shubham Sharma , thanks for your answer , can you provide me an example in oml. It would be helpful for me.

2022-12-12 06-07-07
Dhivyaraj Sivam

Hi Sangam Bhondele,

I have attached an OML file for converting an integer to a decimal.


Regards,

Dhivyaraj


IntegerToDecimal.oml
2022-12-09 04-50-17
Shubham Doshi

Hello Sangam ,

You can use the format decimal function available:

2025-12-17 21-10-06
Shlok Agrawal

Hey @Sangam Bhondele 

Simply just use the 2nd function shown in the image below in your assign function 

Thanks

Shlok Agrawal.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.