74
Views
5
Comments
Solved
Is it possible to display the number "0" as well as trailing zeros in an input field

Hi everyone,

I have two questions here,
1. Is it possible to display the number 0 rather than blank in an input field after we fetch from the database? 

2. Is it possible to display trailing zeros (.00) ? eg. 25.00

I’m looking for suggestions or workarounds for the above two issues that would allow us to achieve this while keeping the field type as "number" for calculations, or if there’s an alternative solution besides change the type to "text"


Thanks in advance

2023-04-06 18-43-50
Mario Díaz
Solution

Hey!

For your first question: 

If you want to display 0 instead of blank, you can add the following attribute in your number input :

https://www.outsystems.com/forums/discussion/61678/when-adding-0-as-a-value-to-form-its-showing-empty-field/#
(Check João Santos' answer)

https://www.outsystems.com/forums/discussion/33763/outsystems-ui-input-widget-doesnt-display-zero-value/#

(Check Rita Dias' answer)


For your second question: 

I am not sure right now and dont have access to service studio. Will try to check it tomorrow.

2020-07-21 19-28-50
Rajat Agrawal
Champion

Hi @Prejith Prasanna Kumar ,

I think you are looking for this result:

For that I attached below OML please refer.

For second point you can use outsystem default function formatDecimal().

For first query instead of changing input field data type you can change variable that is bind with that input field make them text type.


Regards,

Rajat


DecimalShow.oml
UserImage.jpg
Prejith Prasanna Kumar

Hi @Rajat Agrawal ,

Thanks for the response. 
Although it's not quiet what I was looking for. 
I can see you have used the input type for the input field as text, but I was wondering if there is any way to achieve both of those cases when the Input type is number.

2020-07-21 19-28-50
Rajat Agrawal
Champion

Hi @Prejith Prasanna Kumar ,

Same scenario they have discussed in below post also you can refer that without using datatype text.


https://www.outsystems.com/forums/discussion/78204/check-if-0-is-in-input-field/


Regards,

Rajat

UserImage.jpg
Ojasvi Sharma

Hi @Prejith Prasanna Kumar

As much understood from your question, below are few solutions :- 

  • For displaying zero from the database, you can use the "if" condition in the expression to make sure the "0" appears rather than blank space. 
  • And for decimal, you can use "DecimalFormat()" function. 

I hope it will help. 


Regards, 

Ojasvi Sharma

2023-04-06 18-43-50
Mario Díaz
Solution

Hey!

For your first question: 

If you want to display 0 instead of blank, you can add the following attribute in your number input :

https://www.outsystems.com/forums/discussion/61678/when-adding-0-as-a-value-to-form-its-showing-empty-field/#
(Check João Santos' answer)

https://www.outsystems.com/forums/discussion/33763/outsystems-ui-input-widget-doesnt-display-zero-value/#

(Check Rita Dias' answer)


For your second question: 

I am not sure right now and dont have access to service studio. Will try to check it tomorrow.

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