Use same formula with different fields as input

Posted on 2012-09-05
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
    LVL 100

    Expert Comment

    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

    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

    Found the answer myself.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…
    This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now