Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 247
  • Last Modified:

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

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
Eric Love
Asked:
Eric Love
1 Solution
 
mlmccCommented:
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
 
James0628Commented:
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now