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!

if then else problem 1

Status
Not open for further replies.

paverley

Technical User
Dec 4, 2003
38
BE
Something very strange over here:

i created a formula which should put a 1 if true and a 0 if false... but it shows only the 1 , it seems like he doesn't see the else part of my formula!

anyone an idea?


if {ROOTCAUSEM1.CLOSE_TIME} > {ROOTCAUSEM1.DEX_TARGET_WORKAROUND}

then
1
else
0
 
Do you have the two values you are comparing also displayed on your report? Are they the same data type? Are either ever null? Is this a formula field, or is it a condition for suppression? What version of Crystal are you using?
 
Hello

They are both datetime fiels, both displayed in my report.
It's a formula field i'm using , CR version 9.

Ah, wait, i think i've got something: if the close time is not filled in (problem not closed yet) then he puts nothing. Only if that field is filled in , he puts a 1 or a 0...
 
I already tried this but not working...

if {ROOTCAUSEM1.CLOSE_TIME} > {ROOTCAUSEM1.DEX_TARGET_WORKAROUND}
and isnull ({ROOTCAUSEM1.CLOSE_TIME})

then
1
else
0
 
Change your formula to this:
Code:
if not(isnull({ROOTCAUSEM1.CLOSE_TIME})) and{ROOTCAUSEM1.CLOSE_TIME} > {ROOTCAUSEM1.DEX_TARGET_WORKAROUND} then
    1
else 
    0

~Brian
 
We are almost there, but the result has to be 1 when the close time is null (not filled in)?
 
sorry, let me explain it on another way:

when the problem is not closed yet (and the field is null), there are two possibilities:

1) dex_target_workaround is bigger than today: value should be 0

2) dex_target_workaround is smaller than today: 1

sorry for late reaction!!!!
 


if isNull({ROOTCAUSEM1.CLOSE_TIME})
then
(if currentDate() > {ROOTCAUSEM1.DEX_TARGET_WORKAROUND}
then 1 else 0)
else <whatever you want when it's not null>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top