Solved

How can I fix my  an error in crystal report formula?

Posted on 2014-09-04
2
211 Views
Last Modified: 2014-09-27
In a formula I am comparing 2 number to evaluate if (%a >= %b).  It seems to work - but getting errors some. (Both are numbers)

if {@ratio2}>={@.Goal2} then "Pass"
else "Fail"

RATIO:
local buildit as number
local truncit as number
local strit as string
If {Core_.DE} = 0 Then
     formula = "n/a"
Else
    buildit = ({Core_.NU}/{Core_.DE})*100
    truncit = round(buildit, 0)
    strit = totext(truncit, 0)
    formula = strit
end if
     tonumber(Round(({Core_.NU}/{Core_.DE})*100, 0))


Goal:

If {@Metric Name}= "Orders" Then 0.3 Else
If {@Metric Name}= "Medication" Then 0.4 Else

Thanks
0
Comment
Question by:Eric Love
2 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 40303448
What is the MetricName formula?

The GOAL formula appears to be incomplete.

What errors are you getting?

Can any of the database fields be NULL?

Are you using a mix of VB and Crystal syntax in the formulas?

mlmcc
0
 
LVL 34

Accepted Solution

by:
James0628 earned 500 total points
ID: 40305531
I don't use Basic syntax, but isn't the ratio formula setting the result to be a string (either "n/a", or the string variable strit) ?

 If the goal formula is producing a number, then you'll get an error when you try to compare the results from the two formulas.

 First guess:
 Maybe you want to change
     formula = "n/a"
  to
     formula = 0

 And change
    formula = strit
 to
     formula = truncit


 And you should probably remove the last line from the ratio formula (the ToNumber function after the "end if"), since I don't think it does anything.

 James
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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 …
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 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

22 Experts available now in Live!

Get 1:1 Help Now