Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change currency from $ to Euro or another
Message
From
14/11/2018 11:53:31
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01663344
Message ID:
01663358
Views:
30
>>>>>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. :-)
>
>I have never used ReportListener and don't know how much work is involved in changing hundreds of reports to use the ReportListener. Something to explorer.

Do a search for the pdf3.prg program. It has a straight-forward implementation, though its goal is to render to a PDF so there's some of that code in there.

If you want, I can code you a template and attach it as a .ZIP file here. You'll use something like REPORT FORM whatever.frx OBJECT loMyReportListener... The ReportListener class will then pass everything through and you can intercept and update as needed.

Another example to look at is FoxyPreviewer. It's more complex, but it handles various printing models.

UPDATE: Here's an example: http://weblogs.foxite.com/emersonreed/2006/09/13/a-sample-on-how-to-add-features-to-report-listener/
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform