Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change currency from $ to Euro or another
Message
From
14/11/2018 15:12:24
 
 
To
14/11/2018 11:50:44
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01663344
Message ID:
01663369
Views:
47
Likes (1)
>>>>>>How would you go about changing the currency in all reports from a dollar sign to a euro sign or British pound sign or another?
>>>>>
>>>>>How is it specified currently? SET CURRENCY TO will change the currency symbol. But if it's encoded into a character string, you can use a ReportListener object and intercept the incoming string and replace all instances of the $ with something else.
>>>>>
>>>>>You can also open up each .FRX file as a .DBF and update the value you'd like to change if you have a way to set it globally. To find out what to change, copy the report, delete everything except the one thing you want to change as an example, and then compare the two frx files together using sys(2007, x) where x is each field name tested one-by-one in a loop until you find out which fields have changed.
>>>>
>>>>I don't think I have SET CURRENCY TO anywhere in the app; I think it is a literal dollar sign in the reports. So, I will need to change all reports to use the currency symbol and use the SET CURRENCY TO. I don't want to hack the .FRX files.
>>>>Thank you.
>>>
>>>You can use a ReportListener and add a class to monitor the incoming text, and swap out the $ for another symbol.
>>>
>>>See the ReportListener help for EvaluateContents() event. You can add that code to your system and swap out anything you see incoming that you'd like. Make sure to set oObjProperties.reload to .t. if you change anything.
>>>
>>>Using the FRX as a DBF and setting properties differently isn't exactly hacking. It's programmatically addressing the problem. There is a difference. :-)
>>
>>A potential curveball would be position of the currency symbol (e.g. to left or right of numerical value)...
>
>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.

speaking left-to-right to right-to-left... The following link with Japanese text illustrates where misreading the direction could result in unintended meaning.
https://omoganews.com/2018/01/02/eroyama-yamaguchi/
the signage shows text
(株)山口工業所
which translates as "Yamaguchi Kogyo, Ltd" -- written in a right-to-left fashion
but if read left-to-right (and some of the kanji symbols interpreted as being katakana) we end up with:
所業エロ山(株)
which would roughly translate as "deed/act erotic mountain (stock)"

a bit of background: Japanese text is generally written in vertical columns read top-to-bottom and the columns ordered left-to-right. When written horizontally it is typically written in rows read left-to-right with rows ordered top to bottom. There are also occasions where horizontal writing (typically with signage) where it is meant to be read right-to-left (you could think of it as being equivalent of vertical text where the columns are one character high).
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform