Those of you who have worked with subreports know that you can pass a value from the subreport to the main report and back again. But have you ever needed to create a value in one report and use that value in a completely different report? Or maybe store a value from a monthly report to use in next month’s report? Here are 2 ways to accomplish this using 3rd Party dll files:
Chelsea Technologies has just released the Share UFL that allows you to store a value to an external XML file. The value can be then retrieved in any report – even the next instance of this report. And you can store as many values as you need.
Say you have a a report that prompts for an opening balance and accumulates records to calculate a closing balance. Say this closing balance is next month’s opening balance. Here is how you would use the functions provided by the Share UFL.
Formula to store the current value:
ShareTagStore (“c:\Bal.xml”, “Balnce_001”, ToText(Sum({table.field})))
Formula to capture the stored value:
ShareTagFetch (“c:\Bal.xml”,”Balnce_001″)
A free trial version is available for download from the ChelseaTech Web page. The UFL is compatible with all versions of Crystal Reports since version 5. The cost is roughly $100.
Another option is to use the CUT Light DLL provided by Millet Software. This has been around for years and I just remembered that it could be used this way as well. In Cut Light your values are stored in an INI file rather than an XML file, but the function is very similar.
This is the syntax to store a value:
SetINIValue(“c:\BAL.INI”, “balances”, “balance_001”, ToText(Sum({table.field})))
And to retrieve it you could use:
GetINIValue(“c:\BAL.INI”, “balances”, “balance_001”)
The first 3 arguments in each example are: the path to the INI, the section of the INI and the INI key. If the file, section or key don’t already exist they will be created. Cut Light also provides a dozen other useful functions and is only $50.