Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change currency from $ to Euro or another
Message
From
14/11/2018 17:22:10
 
 
To
14/11/2018 15:12:24
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01663344
Message ID:
01663376
Views:
32
>>If you use the ReportListener class you can use something like (untested, off the top of my head):
>>
lcNewSymbol = && Whatever it should be
>>DO WHILE "$" $ oObjProperties.text
>>    oObjProperties.text = STUFF(oObjProperties.text, AT("$", oObjProperties.text), 1, lcNewSymbol)
>>    oObjProperties.reload = .t.
>>ENDDO
>>
>>Something like that should allow you to intercept every one wherever it is, as the data sent to the ReportListener's evaluateContents() event is already in text form, even though the source value is there as well as a variant.
>
>Perhaps I should clarify what I meant. In some locales the currency symbol should be to the left of the number, and in other locales the currency symbol is on the right. A simple search-and-replace wouldn't address this.

You can use the presence of the $ as a trigger to know if it is a currency symbol or not, and then use a STUFF() to remove it, and then use a feature on something like goApp to determine what the currency mark should be and inject it right there:
LOCAL llOnLeft, lcMark

IF "$" $ oObjProperties.text
    oObjProperties.text = ALLTRIM(STUFF(oObjProperties.text, AT("$", oObjProperties.text), 1, SPACE(0)))
    llOnLeft = goApp.lCurrencyOnLeft
    lcMark = goApp.cCurrencyMark
    oObjProperties.text = IIF(llOnLeft, lcMark, SPACE(0)) + oObjProperties.text + IIF(llOnLeft, SPACE(0), lcMark)
    oObjProperties.reload = .t.
ENDIF
Something like that should work. You can create a cursor and examine the contents which flow through that EvaluateContents() method. It basically sends you every value that will be reported on, exactly as it will be reported on. If the $ has already been added by that time, it should work.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform