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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I pass a value to a formula?

Status
Not open for further replies.

eao

MIS
Nov 14, 2001
104
US
I have a formula (@Elapsed) that calculates elapsed time in seconds from an event, and another formula (@DT) that converts the results to HH:MM:SS by calling @Elapsed. This works fine for the usage I originally intended it, however, now I find that I want to reuse the @DT function.

Ultimately, I now want to build a cross-tab where the summarized field is the average of @DT. Because @DT returns a string, I have to take the average of @Elapsed, and pass that value to @DT.

How do I pass a value to a Crystal function so that the function is dynamic? I do not want to have a million functions that converts seconds to HH:MM:SS.

I hope this is possible. Thanks.
 
You can write a UFL - user function library - that will actually add a function to the crystal reports formula editor tree to be used whenever you want it. George Peck's book has an excellent section on UFLs and it is very straightforward. You will end up creating a .dll file and registering the .dll on every machine where you want your user defined function to work.

Hope that helps. Software Support for Sage Mas90, Macola, Crystal Reports, Goldmine and MS Office
 
You won't be able to ross-tab using a formula that is based on an average. See faq149-243 for a technique that is a 'manual' cross-tab. This might help. There is also a generic formula that converts seconds to a time string using variables. This might be more 'dynamci' than your formula.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top