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!

Function faster than simple sum?

Status
Not open for further replies.

kwalters135

Programmer
Dec 29, 2005
48
US
I'm trying to optimize my report. I have formulas that add two summary fields. If I create a simple function that adds two numbers and use that function in the formulas will that make the report execute faster?
 
Please take the time to explain your environment.

Your Crystal version, the database used, what's in the Report->Selection Formulas->Record and in the Database->Show SQL Query, the current execution times, etc.

Certainly minimizing the numbers of sums will help a tad, but if you are sufferinmg from bad performance, making sure that you're using the proper connectivity and that the where clause is passed to the database are the biggest factors.

So, when posting, remember to learn what type of software and database you're using and include that, then state what the difficulty is, with specifics.

Guessing at problems rather than describing them and requesting assistance will limit responses and probably won't resolve the issues.

-k
 
I'm using Crystal XI Developer, full version.

My database is dbase. Here is my selection formula for the report:
{RBD.SCENARIO} = 4 and
{RBD.FILE} = {RM.FILE} and
{gd.FILE} = {RM.FILE}

Within the report, here is a sample of one of my formulas that sums two fields:

formula = Sum ({RBD.END_PRN_7}, {gd.ASS_LIB}) + Sum ({RBD.PAY_PRN_7}, {gd.ASS_LIB})

If I create a custom function such as the following:

Function sum2 (v1 As Number, v2 As Number)
sum2 = v1 + v2
End Function

and change my formulas to use this function to sum two fields, will I see any performance gain?

I have about 40 formulas, otherwise I would just go ahead and change to functions and see what the results are.

This may be a ridiculous idea, but since I'm not using a true SQL compliant database, I don't have a lot of options.

Thanks for your response.


 
Ahhh, got it, and yeah, it should prove slightly faster.

WHy does your record selection have joins in it instead of having them in the GUI itself? Not sure how that might impact performance, or if it's some dbf anomaly.

There is still the issue of whether the database is doing the filtering for you, and you should consider building queries in xBase to return the data in a summary fashion, or even link the xBase files into an Access database and use an Access query to do so.

There are also different ways to connect to a dBase file, depending upon it's version, not sure why you elected not to post how you connect or the dbase version... There's a bative connectivity, and there's ODBC. The native should prove faster, however the ODBC will allow you to see what is being (or attempted to be) passed to the database as filtering.

Again, you don't speak of current execution times, or the required execution time you strive for.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top