Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Testing for Null

Status
Not open for further replies.

BradCustom

IS-IT--Management
Oct 5, 2007
296
US
Below is a formula I'm woring with in Crystal XI. the value is passed from the subreport to the main report. Unfortunately the test for Null values doesn't work because I keep getting an error saying "there needs to be a field here" on the sum function.

Code:
whileprintingrecords;
shared numbervar Allocated := if isnull
(Sum ({SO_Detail.Order_Qty}, {SO_Detail.Material})-Sum ({SO_Detail.Shipped_Qty}, {SO_Detail.Material})
)
then 0
else 
(Sum ({SO_Detail.Order_Qty}, {SO_Detail.Material})-Sum ({SO_Detail.Shipped_Qty}, {SO_Detail.Material}))

Thanks for help on this formula!!
 
I would suggest changing your formula to use default values for null instead of testing for null values. The reason I would take that approach is because I assume order and shipped quantity could both be null. The sum function wont work if either comes back as a null. Changin ght edefault to null will return 0 instead of null.

_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
Try setting up a formula {@Allocated}:

Sum ({SO_Detail.Order_Qty}, {SO_Detail.Material})-Sum ({SO_Detail.Shipped_Qty}, {SO_Detail.Material})

Then change your formula to:

whileprintingrecords;
shared numbervar Allocated := if isnull({@Allocated}) then
Allocated := 0 else
Allocated := {@Allocated};

-LB
 
Thanks LB that works perfectly. I actually had a formula called {@Allocated} so I just needed to change the pass formula.

Thanks angain for your help!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top