Print Page | Close Window

IF THEN ELSE FORMULA TO RETURN NULL?

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=11315
Printed Date: 06 May 2024 at 8:54am


Topic: IF THEN ELSE FORMULA TO RETURN NULL?
Posted By: grecianite
Subject: IF THEN ELSE FORMULA TO RETURN NULL?
Date Posted: 04 Oct 2010 at 5:35am
Hi,
 
I am trying to create a formula that will return a null value if the relevant criteria are not met.  I have previously been returning a zero, but this is no good if I want to find my lowest return, as the lowest number will always be zero....
 
Current formula is
 
if {A_PRICES.PRICE_TYPE}="Ask" then {A_PRICES.PRICE} else 0
 
but I want to write
 
if {A_PRICES.PRICE_TYPE}="Ask" then {A_PRICES.PRICE} else null
 
but get a incorrect string message :(
 
Any help greatly appreciated!!
 
Thanks
 
John



Replies:
Posted By: grecianite
Date Posted: 04 Oct 2010 at 5:49am
If it helps, I basically have a big list of pricesp and lots of price types for every day. 
 
For each date I am showing each price type and to do this I am using an IF THEN ELSE looking for the right argument (text return) and returning the relevant price and if the price does not exist to return a zero.
 
Just want to return something other than zero so I can see my lowest price ever and am just going round in circles at the moment!!


Posted By: DBlank
Date Posted: 04 Oct 2010 at 6:52am
you cannot insert NULLS using a formula.
Consider using a Running Total with a evalaute formula that uses your conditions.


Posted By: grecianite
Date Posted: 05 Oct 2010 at 2:37am
Thanks very much, the Running Total (excluding '0' ) worked fantastically.



Print Page | Close Window