96
Views
2
Comments
Solved
How to replace last 3 zeros with K in a number?
Question

Hi,

I have written a code in Scripts, but unable to access it in the expression it is showing me only the script name it is not showing me the function which i have written.

And is there any other way to replace last 3digits in a number with K please let me know.


Thanks

Harish

2019-06-05 00-34-45
Thiago Zuquinali
Solution

Hi Harish,


we have auxiliar functions in the platform. You can use Substr(Text, Integer, Integer);: https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Logic/Built-in_Functions/Text#Substr

In an exemple:

Substr(Text, 0, Length(Text) - 3) + "KKK"

2019-05-22 11-30-09
Marcelo Ferreira

Hi Harish,

You should have an action that format your numbers. Every time you want to show a number in the screen you use that action to format it. To be easier to use you should mark this action as a function. Inside that action if the number is bigger or equal to 1000 remove the last 3 digits by dividing by 1000 and rounding it.  If you do this just concatenate the "K" to the number you get.

Regards,

Marcelo

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