# How to replace last 3 zeros with K in a number?

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

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"

Solution

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