I have an input which has a data type of Integer.
Upon a toggle of a radio button, I am resetting this input to "". This now sets the Input to "0" as Outsystems recognizes an empty Integer as "0".
Without changing the data type of the input, is there any way that I can reset the input to be empty and not "0" ?
Thanks for the suggestion. I changed it to a Text data type and using REGEX, ran the below action on blur with some screen validation on the input itself.
Hi @Randall Jodache Chetty ,
Your input type (as an integer) has a default value that if undefined is set to 0. Can you give us more information on what are you trying to achieve?
I want to use the on change of the Radio button to set the input to empty.
Just say I have a radio button which reads " Do you want to reset this Integer Input?"
My options are "Yes" and "No".
Lets say that on load the input = 554441122. When I select "Yes", my expected result is for the input to clear out and be empty. Instead when I select "Yes", the input is now "0"
My On Change ("Yes") logic checks if the answer is "Yes" and if so the it sets
Integer=""
Thank you for your quick reply!
You can use it as a text, but since you don't want to change your data type, you can try an IF condition in your input Prompt? IF(var=0,"",var).
Hi Randall,
If you want to differentiate between "" and "0", you'll need a text input (and use a Text variable), not an Integer one. That said, if "Integer = """ works, your variable "Integer" is already a Text, or you'd get an "Invalid Data Type / 'Integer' data type required instead of 'Text'." error.
Hi Kilian,
I tried changing the prompt (as it converts to text) and could do it without changing the the variable data type, simply masking it.
Thoughs on this approach?
Thanks!
Using the below?
IF(var=0,"",var)
What if you actually want to enter in a "0" ?
Probably, it would become transparent and would show up your empty state. However, you can try and implement it. But since it's just the prompt when the variable is no longer empty it can actually work.
If that's a requirement, could you not use text variables and logic do validate and convert it to integer when needed (and vice-versa?)
Regards,
João
Thanks João . This does not seem to work for me though as it still sets it to 0
The requirement is that the user is not allowed to enter any alphabets into the input, that is why I used an Integer data type
Yes, the variable will hold 0, just won't display it.
Regarding your requirement how about go at it with an onblur event or similar approach to not allow inputting your chars?
Thanks. I can have a look at the OnBlur event
Thanks for your reply and the solution you implemented. Kudos!