I want to enter the number in the input field with the data type as text in the following format
xxx,xxx.xx where there is the comma after every 3 digits from the right but I want to store it in the database without a comma so is there any solution for it.
hi Vaibhavi Paranjpe,
you can use inbuilt function Substr().
Examples:Substr("First string", 2, 4) = "rst "
Substr("First string", 0, 100) = "First string"
Substr("First string", 11, 3) = "g"
Substr("First string", Length("First string"), 0) = ""
Substr("First string", 2, 0) = ""
Thanks
Prince
Hi Vaibhavi paranjpe, I Hope this will helpful for you, before you save that value in database, please use the replace -Built in Function in that value . Replace(TextVar,",","")
Hi @Prince Aadil Khan Panwar and @Rajesh Venkat thanks for the solution I'll try to implement this solution.
Try this as well.
Hi @Vaibhavi Paranjpe ,
You can use "InputMask" forge component to achieve this functionality. Here is the link of component please have a look.
https://www.outsystems.com/forge/component-overview/7838/inputmask-react
Regards,
Arun
I want to show comma after every 3 digits in input field so what approach should I follow
Hi,
I have created .oml for you with the input maks component.
Please check it and let me know if you have any query.
Note: Install "InputMask" forge component before uploading .oml to service stuido.
function numberWithCommas(x)
{
x = x.toString();
var pattern = /(-?\d+)(\d{3})/;
while (pattern.test(x))
x = x.replace(pattern, "$1,$2");
return x;
}
console.log(numberWithCommas(1000))
use this function on keypress.
and after submitting use this replace method.
Thank you so much for this I'll refer it and will implement the same in my code. Thanks a lot