Forum Discussion

EfrenTorres's avatar
EfrenTorres
Qrew Member
5 years ago

Formulas Help

Hello, I am trying to get a checkbox to indicate if a vendor is open or closed. I have imputed the vendor times so my variables are like Monday start time, Monday end time ect. The only thing I have figured out is how to get duration. Any help would be great. Thank you

------------------------------
Efren Torres
------------------------------
  • Can you elaborate? Your question refers to a checkbox and then at the end a duration.  Perhaps an example would help.

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • EfrenTorres's avatar
      EfrenTorres
      Qrew Member
      Yes I am making the mistake of trying to do like [Monday start time} - [Monday end time]. This gives me a duration. Thats not what I need at all so Im lost. I need the checkbox to change based on weather the current time is between the start and closed time and also be able to change day to day

      ------------------------------
      Efren Torres
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend
        So to be clear, do you want to check if the current time is between those start and end times, or if the time in a field or perhaps the date time that the record was created was during the open times?  I have given a formula below to give you what you asked for, but it may not be what you need. :)

        Also, I am not sure what you want to do on weekends? Are you also open on Saturday and Sunday?

        var timeofday Time  = ToTimeOfDay(Now());
        var number DayNumber = DayOfWeek(Today());

        $DayNumber = 1 and $Time >= [Monday start time] and and $Time <= [Monday end time]
        or
        $DayNumber = 2 and $Time >= [Tuesday start time] and and $Time <= [Tuesday end time]
        or
        $DayNumber = 3 and $Time >= [Wednesday start time] and and $Time <= [Wednesday end time]
        or
        $DayNumber = 4 and $Time >= [Thursday start time] and and $Time <= [Thursday end time]
        or
        $DayNumber = 5 and $Time >= [Friday start time] and and $Time <= [Friday end time]
        or
        $DayNumber = 6 and $Time >= [Saturday start time] and and $Time <= [Saturday end time]
        or
        $DayNumber = 0 and $Time >= [Sunday start time] and and $Time <= [Sunday end time]



         


        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        mark.shnier@gmail.com
        ------------------------------