Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula - A number is required here Post Reply Post New Topic
Author Message
DarlaE
Newbie
Newbie
Avatar

Joined: 03 Oct 2008
Online Status: Offline
Posts: 2
Quote DarlaE Replybullet Topic: Formula - A number is required here
     Posted: 03 Oct 2008 at 7:50am
The is the formula that I have entered
{Entities_BCO.EntLookup} = "enco" and
{InsPolicy.PolExpDate} > DateTime (2008, 09, 01, 0, 0, 0) and
if{InsLine.LineAnnualizedPrem} >= '0' then Maximum ({InsCovTerm.CovTermVersion})
 
When I check the formula is brings up the error "A number is required here".  It hightlights the '0' that I have entered in the if line.  I've tried entering a number 1 also.  What am I doing wrong? 
Darla
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 03 Oct 2008 at 9:34am

On the third line, there shouldn't be an 'if' statement stuck in the middle of the formula. 'IF' can only go at the beginning of a line. I would move the 'IF' to the beginning of the first line and that should get you closer to the correct result.

 
I have the complete Crystal syntax documented in my Encyclopedia book and sample code listings. You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
DarlaE
Newbie
Newbie
Avatar

Joined: 03 Oct 2008
Online Status: Offline
Posts: 2
Quote DarlaE Replybullet Posted: 03 Oct 2008 at 10:15am
I tried what you requested, and i am now receiving an error "A boolean is required here.'.  The error is highlighting the "0" after else.
 
if {InsLine.LineAnnualizedPrem} >= 0 then Maximum({InsCovTerm.CovTermVersion})
else 0 and
{InsPolicy.PolExpDate} > DateTime (2008, 09, 01, 00, 00, 00) and
{Entities_BCO.EntLookup} = "enco"
Darla
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 03 Oct 2008 at 10:22am
Well, you move the "then" to the middle of the statement now. Try this:
 
if {InsLine.LineAnnualizedPrem} >= 0  and
{InsPolicy.PolExpDate} > DateTime (2008, 09, 01, 00, 00, 00) and
{Entities_BCO.EntLookup} = "enco"
then  Maximum({InsCovTerm.CovTermVersion}) 
else 0
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
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