Topic Options
#57036 - 05/15/19 01:17 PM insert a space
Sami786 Offline
OL Expert

Registered: 01/29/14
Posts: 306
Loc: Home
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


Edited by Sami786 (05/15/19 01:19 PM)
_________________________
Peace

Top
#57037 - 05/15/19 01:27 PM Re: insert a space [Re: Sami786]
jouberto Offline
OL Toddler

Registered: 04/18/18
Posts: 32
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,

Top
#57038 - 05/15/19 01:29 PM Re: insert a space [Re: Sami786]
Sami786 Offline
OL Expert

Registered: 01/29/14
Posts: 306
Loc: Home
I'll try that and will let you know if anything,
Thank you so much for the info
_________________________
Peace

Top
#57039 - 05/15/19 02:05 PM Re: insert a space [Re: Sami786]
Sami786 Offline
OL Expert

Registered: 01/29/14
Posts: 306
Loc: Home
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()
_________________________
Peace

Top
#57040 - 05/15/19 02:14 PM Re: insert a space [Re: Sami786]
jouberto Offline
OL Toddler

Registered: 04/18/18
Posts: 32
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,' '),'.',',')

Top
#57041 - 05/15/19 03:49 PM Re: insert a space [Re: Sami786]
Sami786 Offline
OL Expert

Registered: 01/29/14
Posts: 306
Loc: Home
that worked as expected! greatly appreciated smile all your help

THANKS
_________________________
Peace

Top