Solved

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

Posted on 2014-09-04
2
215 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

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 …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

785 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