Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: error 20510 Invalid formula name Post Reply Post New Topic
Page  of 2 Next >>
Author Message
snyper19
Newbie
Newbie
Avatar

Joined: 15 Jul 2009
Location: United States
Online Status: Offline
Posts: 10
Quote snyper19 Replybullet 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 IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet 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 IP Logged
snyper19
Newbie
Newbie
Avatar

Joined: 15 Jul 2009
Location: United States
Online Status: Offline
Posts: 10
Quote snyper19 Replybullet Posted: 18 Feb 2010 at 9:19am
That's how it was when I started working on this report.
IP IP Logged
snyper19
Newbie
Newbie
Avatar

Joined: 15 Jul 2009
Location: United States
Online Status: Offline
Posts: 10
Quote snyper19 Replybullet 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 IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet 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 IP Logged
snyper19
Newbie
Newbie
Avatar

Joined: 15 Jul 2009
Location: United States
Online Status: Offline
Posts: 10
Quote snyper19 Replybullet 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 IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet 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 IP Logged
snyper19
Newbie
Newbie
Avatar

Joined: 15 Jul 2009
Location: United States
Online Status: Offline
Posts: 10
Quote snyper19 Replybullet Posted: 18 Feb 2010 at 10:38am
mmm... that did not work either... it gave me the same error...
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet 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 IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet 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 IP Logged
Page  of 2 Next >>
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.