Print Page | Close Window

error 20510 Invalid formula name

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=9152
Printed Date: 06 May 2024 at 11:01am


Topic: error 20510 Invalid formula name
Posted By: snyper19
Subject: error 20510 Invalid formula name
Date 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,



Replies:
Posted By: hilfy
Date 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


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: snyper19
Date Posted: 18 Feb 2010 at 9:19am
That's how it was when I started working on this report.


Posted By: snyper19
Date 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.


Posted By: hilfy
Date 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


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: snyper19
Date 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.


Posted By: hilfy
Date 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


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: snyper19
Date Posted: 18 Feb 2010 at 10:38am
mmm... that did not work either... it gave me the same error...


Posted By: kevlray
Date 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.


Posted By: hilfy
Date 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:
 
mailto:%7b@rs - {@rs }
f (isnull({TicketProduct.SourcePercentOfRoute}) or ({TicketProduct.SourcePercentOfRoute} = 0)) then 1
else {TicketProduct.SourcePercentOfRoute} * 0.01
 
mailto:%7b@sp - {@sp }
if (isnull({TicketProduct.ProductPercentOfSource}) or ({TicketProduct.ProductPercentOfSource} = 0)) then 1
else {TicketProduct.ProductPercentOfSource} * 0.01

mailto:%7b@FinalValue - {@FinalValue } (name this whatever the final value means)
Round (({TicketLoad.TotalCost} * mailto:%7b@rs - {@rs } * mailto:%7b@sp - {@sp } ), 3)
 
-Dell
 


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: snyper19
Date Posted: 18 Feb 2010 at 2:15pm
Thanks for all  your help

I've tried what you said and create other formulas, and it didn't work either... I even removed all the formulas and leave mostly text objects.... and it still giving me the same error



Posted By: hilfy
Date Posted: 18 Feb 2010 at 3:33pm

If you haven't put the formula on the report, then it's not what's causing the error.  The report template itself may have gotten corrupted at some point so you may need to try creating the report from scratch.

-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window