Use same formula with different fields as input

Posted on 2012-09-05
Medium Priority
Last Modified: 2012-09-10
In a Crystal Report using Visual Studio 2008, I need to do the same formula calculation using two different data fields. The result is fed to another formula. Is there a way to specify which field I want to process as an argument to the formula, or am I stuck with having two virtually identical formulas, each hardcoded with the correct input field?

I've seen a couple of online references to a Function keyword, but I can't figure out how to use it. I tried to create a simple formula of:

Function (DateVar StartDate)
Month (StartDate)

When I try to save the formula, CR reports back: "The remaining text does not appear to be part of the formula" and highlights everything.
Question by:ElrondCT
  • 2
LVL 101

Expert Comment

ID: 38369272
I believe you are referring to building a function nthat will reside in the repository.  

DO you have a full version of Crystal or the version that comes with VS2008?

I don't think the VS2008 version can use the repository.

LVL 20

Accepted Solution

ElrondCT earned 0 total points
ID: 38369666
I don't have a full version of CR; just the version that comes with Visual Studio (listed as v10.5). It's always annoying to try to figure out what's in the embedded version and what's not. I'm not really looking for a repository function (though that would actually be nice; I do have some formulas that I use in more than one report); just something that I can use twice in a single report.

Actually, I looked back at one of the pages I had looked at, and discovered that the key is to create a "Custom Function" rather than a "Formula", which is selected in Formula Workshop, clicking on the downarrow next to the New icon. Apparently the Function keyword only works for Custom Functions, not Formulas. It looks like this only applies to an individual report, not a common set, but that meets my need for now.
LVL 20

Author Closing Comment

ID: 38382363
Found the answer myself.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

755 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question