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

Moving formula fields to a differnt report

Status
Not open for further replies.

paulcedarhill

Technical User
Mar 22, 2004
46
US
I am linking to a sql database where the original programmer stored phone numbers as strings and an input mask to make the screen view look right. I have just finished writing all the formulas to make them look like phone numbers in crystal but now I need to transfer these formulas to about 50 reports.

here is the code in case any one else is struggling with the same issue.

Dim cmpnyphone as String
cmpnyphone = "("+{tblContacts.fldPrim_Ph}(1 to 3)+") "+{tblContacts.fldPrim_Ph}(4 to 6)+"-"+{tblContacts.fldPrim_Ph}(7 to 10)
formula = cmpnyphone

how can I share or move this formula to another report?
 
Well, if you are using version 9 or 10, you can turn it into the formula into a custom function, add it to the repository, and then add it to your reports.

If not, you can copy the formula as it sits on your report, and then paste it into the next report. It will add it to the report as the same name as the original. You will need to update the contents of the formula if "tblContacts" table isn't included in the new report.

Either way, you have some work ahead of you. You will need to open up every report individually and add the formula. The nice thing with the repository is that if you ever had to change the formula, you can update the repository, and then have it update in all the other reports the next time they are opened.

One last option would be to use a product from a company called Software Forces. Their product is called ".rpt Inspector". This allows multiple report objects to opened at once, and have multiple changes applied to all of them. It is very resonably priced and no I am not affiliated with them at all.

~Brian
 
Please post Crystal version when posting.

To add to Brian's excellent post, if you're using CR 8.5 or below, you can open the source report, drop all of the object that you're interested in copying onto an open area of the report, lassoo them all, select Ctrl-C (copy), switch to the target report, select Ctrl-V (paste), and then select delete.

All of the formulas will now be in the target report. Open the next target report, select Ctrl-V and delete, etc.

-k
 
Brian and "-k"
Thanks for the prompt response!
Sorry for not posting the version, I am using 9.2.

I tried converting it to a custom function only to get an error stating you can't use a field in a custom function expression.

I have been using hte copy paste method, but not the easy way you describe it, I have been copying the basic syntax, then re-creating the fields. I tried the lassoing, works great!

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top