How to create a rule to check if the time is within range

I need some help to create an expression rule to check if my given time is within the range. For example, my process model will start running today at 6PM then should stop running at 5AM the next day. Now I need to create a validation where it returns true/false to check if the execution time is still within the range. Hope anyone could help me. Thank you.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Agree with Stefan.. When you are looping to restart the execution just put an XOR gate and check the time. If it's more than 5am, end the process

  • Hello there, I already have the XOR my problem is how to put a logic where the xor will redirect to end node if the time is beyond 5AM. If I use the logic now() > totime("5:00 AM") and the time is 12:00 AM onwards, then 12:00 AM > 5:00 AM is false which will lead to ending the process model early than the expected time limit. I came up with this script instead. I am just not confident with the logic if it's appropriate

    a!localVariables(
        local!dateTime: right(text(ri!timeNow,"hh:mm AM/PM"),2),
        local!castTime: cast(8, local(ri!timeNow)),
        if(
          local!dateTime = "AM",
          local!castTime < totime("5:00 AM"),
          local!castTime > totime("5:00 AM")
        ) 
      )

Reply
  • Hello there, I already have the XOR my problem is how to put a logic where the xor will redirect to end node if the time is beyond 5AM. If I use the logic now() > totime("5:00 AM") and the time is 12:00 AM onwards, then 12:00 AM > 5:00 AM is false which will lead to ending the process model early than the expected time limit. I came up with this script instead. I am just not confident with the logic if it's appropriate

    a!localVariables(
        local!dateTime: right(text(ri!timeNow,"hh:mm AM/PM"),2),
        local!castTime: cast(8, local(ri!timeNow)),
        if(
          local!dateTime = "AM",
          local!castTime < totime("5:00 AM"),
          local!castTime > totime("5:00 AM")
        ) 
      )

Children