Author |
Message |
snyper19
Newbie
Joined: 15 Jul 2009
Location: United States
Online Status: Offline
Posts: 10
|
Topic: error 20510 Invalid formula name Posted: 18 Feb 2010 at 8:51am |
Hello, I am new to CR, I need help solving an issue with this Crystal Reports... it seems to be fine but when we run the report, I get this box saying (Error Invalid Formula Name). any help I really appreciate it. below is the code in case anyone wants to see it.
numberVar rs := 0; numberVar sp := 0;
if (isnull({TicketProduct.SourcePercentOfRoute}) or ({TicketProduct.SourcePercentOfRoute} = 0)) then rs := 1 else rs := ({TicketProduct.SourcePercentOfRoute} * 0.01);
if (isnull({TicketProduct.ProductPercentOfSource}) or ({TicketProduct.ProductPercentOfSource} = 0)) then sp := 1 else := ({TicketProduct.ProductPercentOfSource} * 0.01);
Round (({TicketLoad.TotalCost} * rs * sp ), 3);
Thank you,
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
|
Posted: 18 Feb 2010 at 9:03am |
Is this a typo in what you've written above or is it in your formula this way?
else := ({TicketProduct.ProductPercentOfSource} * 0.01);
It should be
else sp := ({TicketProduct.ProductPercentOfSource} * 0.01);
-Dell
|
|
IP Logged |
|
snyper19
Newbie
Joined: 15 Jul 2009
Location: United States
Online Status: Offline
Posts: 10
|
Posted: 18 Feb 2010 at 9:19am |
That's how it was when I started working on this report.
|
IP Logged |
|
snyper19
Newbie
Joined: 15 Jul 2009
Location: United States
Online Status: Offline
Posts: 10
|
Posted: 18 Feb 2010 at 9:20am |
I don't know if it matters or not... but this report was done with CR7. and when I click if there are any errors, it doesn't show any error.
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
|
Posted: 18 Feb 2010 at 9:45am |
You need to change it like I show above and then run it to see what happens. The formula is wrong and that's what's causing your problem.
-Dell
|
|
IP Logged |
|
snyper19
Newbie
Joined: 15 Jul 2009
Location: United States
Online Status: Offline
Posts: 10
|
Posted: 18 Feb 2010 at 9:51am |
oh, my bad (typo)...but yeah... the way you wrote it, its the way it is... but still it gives me the error.
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
|
Posted: 18 Feb 2010 at 9:55am |
Try taking the final semi-colon ";" off the end. With it on there, you won't actually have a value returned.
-Dell
|
|
IP Logged |
|
snyper19
Newbie
Joined: 15 Jul 2009
Location: United States
Online Status: Offline
Posts: 10
|
Posted: 18 Feb 2010 at 10:38am |
mmm... that did not work either... it gave me the same error...
|
IP Logged |
|
kevlray
Admin Group
Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
|
Posted: 18 Feb 2010 at 10:58am |
I would make temp formulas and have each if statement isolated so that it will be easier to isolate the issue.
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
|
Posted: 18 Feb 2010 at 11:01am |
The formula looks ok to me. I would try commenting out parts of it and then running the report to see if you can determine which statement is actually giving the error.
Another thing you could try doing is to split it out into three separate formulas instead of using variables. It would look something like this:
f (isnull({TicketProduct.SourcePercentOfRoute}) or ({TicketProduct.SourcePercentOfRoute} = 0)) then 1 else {TicketProduct.SourcePercentOfRoute} * 0.01
if (isnull({TicketProduct.ProductPercentOfSource}) or ({TicketProduct.ProductPercentOfSource} = 0)) then 1 else {TicketProduct.ProductPercentOfSource} * 0.01 {@FinalValue} (name this whatever the final value means)
Round (({TicketLoad.TotalCost} * {@rs} * {@sp} ), 3)
-Dell
|
|
IP Logged |
|
|