Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Crystal Code help Post Reply Post New Topic
Author Message
ukcrystalhelp
Newbie
Newbie


Joined: 13 May 2010
Online Status: Offline
Posts: 3
Quote ukcrystalhelp Replybullet Topic: Crystal Code help
     Posted: 13 May 2010 at 1:20am
Hello,

Hoping someone can help with this please...

Basically, I'm fairly new to Crystal Reports and seeking help with the correct code/syntax to state the following on one of my existing Crystal reports...

Currently I have this paragraph in one of my reports:

{Property.Current_Asking_Price}*({Property.Sole_Terms}/100)

I need to amend this to reflect the following...

If {Property.Current_Asking_Price}*({Property.Sole_Terms}/100) =<1600 then (£1600 plus VAT)
else {Property.Current_Asking_Price}*({Property.Sole_Terms}/100)

I know this syntax isn't correct but wondered if someone can please assist?

Thanks.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 13 May 2010 at 3:40am
it would seem that you just need to replace  (£1600 plus VAT) with its value... 1600 * (however the tax is figured), and if it constant, say 10% for example, then just print that number...1760
 
HTH
IP IP Logged
ukcrystalhelp
Newbie
Newbie


Joined: 13 May 2010
Online Status: Offline
Posts: 3
Quote ukcrystalhelp Replybullet Posted: 15 Jun 2010 at 3:53am
Thanks for that... the figure won't remain constant, so I would like to keep the '(£1600 plus VAT)' text in the code. However, I am still getting the following error:
 
"a string is required here"
 
This appears after the 'else' word. Any ideas welcome please.
 
Thank you.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 15 Jun 2010 at 4:29am

You will need to do a totext on the else part of the if.

If {Property.Current_Asking_Price}*({Property.Sole_Terms}/100) =<1600 then (£1600 plus VAT)
else totext({Property.Current_Asking_Price}*({Property.Sole_Terms}/100))
 
The totext also will let you set the number of decimal points needed (defaults to two).
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 16 Jun 2010 at 3:59am
I agree...both sides of the if then / else side must return the same type of item...since the if side is returning a string, the else side must as well.
 
 
IP IP Logged
ukcrystalhelp
Newbie
Newbie


Joined: 13 May 2010
Online Status: Offline
Posts: 3
Quote ukcrystalhelp Replybullet Posted: 16 Jun 2010 at 4:06am
Excellent - thank you all for your help. Now seems to be working.
IP IP Logged
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