Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import formula to another report - formula 'dictionary'

Status
Not open for further replies.
May 25, 2000
26
AU
I'm trying to find a way to re-use formulae across multiple reports - more specifically import themn from one report into another. Howoever it would be nice to have something like a formula dictionary or public formulas.... I've tried the Seagate knowledge base and forums and this forum. Can't seem to find anything on this.... I'm using CR7.02.
 
In the designer, have the "source" report and the "destination" report both open. In the source report, select the formula field you want, and then
Ctrl-C to copy the formula into the clipboard.
Ctrl-Tab to switch to the destination report.
Ctrl-V to insert the formula into the destination report.

This is the quickest way to do I know of in v7. Malcolm
Remember, if it wasn't for electricity, we'd be surfing the net by candlelight.
 
Crystal allows you to build a data dictionary that includes formulas. This can then be used as a data source. This is handy if you have non-technical users, but the formula editor is limited to version 5 functions. There are also some other limitations:

You can only create one view of linked tables at a time in the dictionary, so usually you need several different dictionaries.

Once a report is started using a dictionary it can't be divorced from the dictionary to run directly against the data.

Malcolm's idea is a great tip, and also works for parameter fields. You can even drop several formulas and parameters into a single text object, and copy that one text object to the new report. This will add all of those objects to the new report in one step. Even if you delete the text object, all of the objects have been added to the fields windows. Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Kristen,
It sounds like what you really want is a UFL(User Function Library) a UFL is a specific kind of .dll that can be created using VB, C, Delphi, or any other 32 bit programming environment that can create COM components. Once you create a UFL the formulas you define will show up in the Crystal Reports formula editor, just like the built in function. The only catch is that there's no 'formula writer' built into Crystal, you have to be able to program in one of the languages mentioned above. If you want more specific information on this let me know and i will post it.

Ruairi
ruairi@logsoftware.com
Experienced with:

VB6, SQL Server, QBASIC, C(unix), MS Office VBA solutions

ALSO: Machine Control/Automation using GE and Omron PLC's and HMI(human machine interface) for industrial applications
 
Unfortunately we are talking A LOT of formulas... cut and paste is fine but for hundreds of formulas and hundreds of reports it's a tad time consuming...

However the UFL idea sounds perfect. I am a VB programmer so that's no problem. So if the .dll is in the user's seagate .dll folder they will automatically be available? Fabulous!!! Exactly what I need!!!!

Thanks SOOOO much Ruairi - you've saved me many hours of work!!
 
Kristen,
I think i may have gotten your hopes up for nothing. Usually formulas deal with database fields. I dont think any database fields can be used in these functions(at least i dont see how they could be after looking at how it works). Basically UFL's add to the list of functions you have available to build formulas. If you want to see for yourself what they're all about heres the steps to writing one.

1) Open an active-x dll project in VB
2) Add any functions you want to implement as public functions in the class module (arguments should be ByRef)
3) The First letters of your project name must be CRUFL the rest can be whatever you want Ex. CRUFLTestFunctions
4) Compile the .dll the next time you open crystal reports the functions from your .dll will be added to the list under "Additional Functions"
Ruairi
ruairi@logsoftware.com
Experienced with:

VB6, SQL Server, QBASIC, C(unix), MS Office VBA solutions

ALSO: Machine Control/Automation using GE and Omron PLC's and HMI(human machine interface) for industrial applications
 
You know what - my fault cause I didn't read what you wrote properly!

User FUNCTIONS!!!! Not User formulas! Oh well! Still could come in handy one day....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top