Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Need help with formula in Crystal Post Reply Post New Topic
Author Message
iversa
Newbie
Newbie


Joined: 12 May 2010
Location: Canada
Online Status: Offline
Posts: 4
Quote iversa Replybullet Topic: Need help with formula in Crystal
    Posted: 12 May 2010 at 11:41am
I have this formula in Crystal which works except for the end.

When I add:

then "Not confirmed"

I get an error stating "A number, currency amount, Boolean, data, time, date-time, or string is expected here"

When I just use "Not confirmed" the formula works but won't print "Not confirmed"


if {ORDE_WB_MAIN.STA_DOCK} = true
    then "Stacked"
else
if {ORDE_WB_MAIN.REL_STACK} = true
    then "Released for Stacking"
else
if {ORDE_WB_MAIN.CUST_NOTIF} = true
    then "Customer Notified"
else
if {ORDE_WB_MAIN.ORD_COMP} = true
    then "Order Complete"
else
if {ORDE_WB_MAIN.ON_HOLD} = true
    then "On Hold"
else
if {ORDE_WB_MAIN.ORD_WIP} = true
    then "Order Released (W.I.P.)"
else
if {ORDE_WB_MAIN.PARTS_ORD} = true
    then "Parts Ordered"
else
if {ORDE_WB_MAIN.ORD_CONFIR} = true
    then "Order Confirmed"
else
   "Not Confirmed"
Gerhard
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 May 2010 at 11:59am
Hmmm...
Where exactly did the cursor go to on the error?
 
A couple of items...
Assuming all of these are boolean fields the =TRUE part is not needed.
Also if any of the fields can have NULL instead of true/false and you are not using 'default values for nulls' it will stop evaluation when it hits a null and then return no value (your blanks).
 
 
if {ORDE_WB_MAIN.STA_DOCK} then "Stacked"
else
if {ORDE_WB_MAIN.REL_STACK} then "Released for Stacking"
else
if {ORDE_WB_MAIN.CUST_NOTIF} then "Customer Notified"
else
if {ORDE_WB_MAIN.ORD_COMP} then "Order Complete"
else
if {ORDE_WB_MAIN.ON_HOLD} then "On Hold"
else
if {ORDE_WB_MAIN.ORD_WIP} then "Order Released (W.I.P.)"
else
if {ORDE_WB_MAIN.PARTS_ORD} then "Parts Ordered"
else
if {ORDE_WB_MAIN.ORD_CONFIR} then "Order Confirmed"
else "Not Confirmed"
 
The NULL issue is my guess as to why 'Not confirmed' is not printing.
Were the cursor goes to indicate an error will help determine a fix for that.


Edited by DBlank - 12 May 2010 at 12:09pm
IP IP Logged
iversa
Newbie
Newbie


Joined: 12 May 2010
Location: Canada
Online Status: Offline
Posts: 4
Quote iversa Replybullet Posted: 12 May 2010 at 12:26pm
Originally posted by DBlank

Hmmm...
Where exactly did the cursor go to on the error?

 

A couple of items...

Assuming all of these are boolean fields the =TRUE part is not needed.

Also if any of the fields can have NULL instead of true/false and you are not using 'default values for nulls' it will stop evaluation when it hits a null and then return no value (your blanks).

 

 

if {ORDE_WB_MAIN.STA_DOCK} then "Stacked"elseif {ORDE_WB_MAIN.REL_STACK} then "Released for Stacking"elseif {ORDE_WB_MAIN.CUST_NOTIF} then "Customer Notified"elseif {ORDE_WB_MAIN.ORD_COMP} then "Order Complete"elseif {ORDE_WB_MAIN.ON_HOLD} then "On Hold"elseif {ORDE_WB_MAIN.ORD_WIP} then "Order Released (W.I.P.)"elseif {ORDE_WB_MAIN.PARTS_ORD} then "Parts Ordered"elseif {ORDE_WB_MAIN.ORD_CONFIR} then "Order Confirmed"else "Not Confirmed"

 

The NULL issue is my guess as to why 'Not confirmed' is not printing.

Were the cursor goes to indicate an error will help determine a fix for that.


Yes all fields are boolean and there are no NULL fields. The fields are either True or False

I did the formula as you suggested but it still does not work.

When I right click the formula to browse the data I get
"Stacked"
"Released for Stacking"
"Customer Notified"
"Order Complete"
"On Hold"
"Order Released (W.I.P.)"
"Parts Ordered"
"Order Confirmed"

but no
"Not confirmed"
Gerhard
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 May 2010 at 5:22am

do a select statement to see if you have any records that meet the all FALSE condition you have set to return that missing value...

NOT ({ORDE_WB_MAIN.STA_DOCK} and
{ORDE_WB_MAIN.REL_STACK} and 
{ORDE_WB_MAIN.CUST_NOTIF} and 
{ORDE_WB_MAIN.ORD_COMP} and 
{ORDE_WB_MAIN.ON_HOLD} and 
{ORDE_WB_MAIN.ORD_WIP} and 
{ORDE_WB_MAIN.PARTS_ORD} and
{ORDE_WB_MAIN.ORD_CONFIR})
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.043 seconds.