When I use the Try function, it goes to failover but when I remove it, the expression calculates correctly. Why is that? I'm probably doing something wrong. How would I fix this?
Here is the code:
try(
if(now()>=todate(tostr(dateformat(if(todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[5,4] + ':00')>=todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + '00:00' + ':00') &&
todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[5,4] + ':00')<todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[0,4] + ':00'),
addDays({[.]Production Shift 1/Working Date},1), {[.]Production Shift 1/Working Date}
),
'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[5,4] + ':00') &&
now()<todate(tostr(dateformat(if(todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[5,5] + ':00')>=todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + '00:00' + ':00') &&
todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[5,5] + ':00')<todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[0,4] + ':00'),
addDays({[.]Production Shift 1/Working Date},1), {[.]Production Shift 1/Working Date}
),
'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[5,5] + ':00') &&
{[.]Production Shift 1/Hours/Shift Var}!=11,
secondsbetween(now(), todate(tostr(dateformat(if(todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[5,5] + ':00')>=todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + '00:00' + ':00') &&
todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[5,5] + ':00')<todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[0,4] + ':00'),
addDays({[.]Production Shift 1/Working Date},1), {[.]Production Shift 1/Working Date}
),
'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[5,5] + ':00')
),
if(now()<todate(tostr(dateformat(if(todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[5,4] + ':00')>=todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + '00:00' + ':00') &&
todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[5,4] + ':00')<todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[0,4] + ':00'),
addDays({[.]Production Shift 1/Working Date},1), {[.]Production Shift 1/Working Date}
),
'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[5,4] + ':00'),
secondsbetween(todate(tostr(dateformat(if(todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[5,4] + ':00')>=todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + '00:00' + ':00') &&
todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[5,4] + ':00')<todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[0,4] + ':00'),
addDays({[.]Production Shift 1/Working Date},1), {[.]Production Shift 1/Working Date}
),
'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[5,4] + ':00'),
todate(tostr(dateformat(if(todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[5,5] + ':00')>=todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + '00:00' + ':00') &&
todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[5,5] + ':00')<todate(tostr(dateformat({[.]Production Shift 1/Working Date}, 'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[0,4] + ':00'),
addDays({[.]Production Shift 1/Working Date},1), {[.]Production Shift 1/Working Date}
),
'MM/dd/yyyy')) + ' ' + {[.]Production Shift 1/Hours/Breaks}[5,5] + ':00')
),
0)
),
99)
Thanks,