Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: Error in Formula while calculating Percentage ... Post Reply Post New Topic
Author Message
yasinirshad
Newbie
Newbie
Avatar

Joined: 24 Sep 2007
Location: Saudi Arabia
Online Status: Offline
Posts: 39
Quote yasinirshad Replybullet Topic: Error in Formula while calculating Percentage ...
    Posted: 22 Dec 2009 at 12:07am
Hi,
Am usin below formula,
IIF ({A.A_I} =0,0,convert(decimal(6,2),abs((({A.A_I})-abs({B.A_I}))/abs({A.A_I})*100)))
And get error "A number,currency,amount,boolean,date-time,or string is expected here" while 'convert' is highlighted.
 
Alternatively, Using Case as below:
(case {A.A_I} when '0' then '0' else convert(decimal(6,2),abs((({A.A_I})-abs({B.A_I}))/abs({A.A_I})*100)) end))
I get Error "The ) is missing" while 'case' is highlighted.
 
Thanks to help with any one of above formula's..whereas i need to calculate percentage...
Thanks,
Yasin.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 24 Dec 2009 at 6:47am
(case {A.A_I} when '0' then '0' else convert(decimal(6,2),abs(({A.A_I}-abs({B.A_I}))/({A.A_I}*100)) end))
I think has the correct the number of parens, but it is the wrong syntax...CR doesn't use the SQL case statement.
 
 
IIF ({A.A_I} =0,0,abs(({A.A_I}-abs({B.A_I})/(({A.A_I}*100)) should work for you value...again, CR doesn't use the SQL Server convert statement.
 
CR XI uses a syntax that is closer to vb6.
 
HTH
 
IP IP Logged
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.