I adjusted the SPL a bit, so it does work. I would still suggest to integrate the date, if you access to the date for sla start- and endtime. | eval status=if(curr_date_hour>substr(SLA_start_time,1,2) AND curr_date_hour>=substr(SLA_end_time,1,2) AND SLA_start_time < SLA_end_time, "COMPLETED", if(curr_date_hour<substr(SLA_start_time,1,2),"NOT_STARTED", if(curr_date_hour>=substr(SLA_start_time,1,2) AND (curr_date_hour<substr(SLA_end_time,1,2) OR SLA_start_time > SLA_end_time),"RUNNING", "ERROR_IN_STATUS_DETECTION"))) I adjusted the detection of COMPLETED by adding "AND SLA_start_time < SLA_end_time" and for RUNNING ones by adding "OR SLA_start_time > SLA_end_time", assuming the sla end hour is smaller when it is refering to the next date. This might not work for all cases. It would be more clean to work with the whole date. Also it might be more readable working with case instead of ifs.
... View more