insert a space

Posted by: Sami786

insert a space - 05/15/19 01:17 PM

Hi, I'm facing an issue with French data, where I need to insert a blank space after the first digit when the value is bigger than 999.

I need to change 1720,00$ to 1 720,00$

my press talk is as below

&SecondYearVPU := floattostr( &TotalValue * 2,2)

% I think I need an if statement to do below: but how? I search help but couldn't find anything to help me!

If (&SecondYearVPU > '999')
&Thirdvalue := stringInsert('[0]',' ')
Endif

Show(&ThirdValue)

Thank you for your help
Posted by: jouberto

Re: insert a space - 05/15/19 01:27 PM

Hi Sami,

We have existing global functions that will do that for you. They can be found here:
http://help.objectiflune.com/en/#pps-plugins
The first function library is the Amounts. Download that on your PC and extract them. From designer, in the tools tab, you have the global function libraries manager. Open that and set it to look into the folder where you extracted the functions. There will be a FormatAmountStr() function that will allow you to determine a thousands separator and will output your amount as expected. Then simply call that function and pass it your original amount where you want to show the "french" amount.

Regards,
Posted by: Sami786

Re: insert a space - 05/15/19 01:29 PM

I'll try that and will let you know if anything,
Thank you so much for the info
Posted by: Sami786

Re: insert a space - 05/15/19 02:05 PM

Hi Jouberto, I go the global function installed and now I used below code with no luck. Can you help please.


define(&data1, string,@FormatAmountStr(&SecondYearVPU),''))
endfunction()

I also found below code but don't know how to apply this!
&result:=@FormatAmountStr(curtostr(&SecondYearVPU),&ThousandSep)
endfunction()
Posted by: jouberto

Re: insert a space - 05/15/19 02:14 PM

Hi Sami,

You must not edit the function. You must only call it. Make sure you revert back to the original code, then in a data selection object, show the following:
=@FormatAmountStr(youramounthere,' ')

The only thing that you might need to do is change the decimal point to a comma in the global function. If you're not familiar with global functions syntax and mechanics, another method could be:
=stringreplace(@FormatAmountStr(youramounthere,' '),'.',',')
Posted by: Sami786

Re: insert a space - 05/15/19 03:49 PM

that worked as expected! greatly appreciated smile all your help

THANKS