Okay I have a formula that should be working, but isn't.
here is the formula:
if {WP_INTRA_OP_02.TOURN_UP1_TIME} <> datetime(1800,01,01,00,00,00) OR
{WP_INTRA_OP_02.TOURN_DOWN1_TIME} <> datetime(1800,01,01,00,00,00)
and {WP_MISC.CODE_17} = 0 or isnull({WP_MISC.CODE_17})
and...