Forum Discussion

Re: Novice in need of help with rental rate formula

Dan:

Got it!  "AND" operator doesn't work.  The information you provided worked just fine  (just a couple more similar lines to create the ranges).

Thank you!  Was getting frustrated.

Dirk

2 Replies

  • RobIV's avatar
    RobIV
    Qrew Cadet
    Dirk,

    Did you test Dan's solution?  It should work without the ranges due to the order in which the program runs its evaluations, i.e. - Will check <=3 first, if that fails will move to <=24, if that fails will just charge monthly rate.

    TL;DR

    But, with that being said, you can use AND to enforce ranges, but you have to declare the object you are comparing values to each time.  

    You have:

    ...
     [Rental Days] >=1 AND <=  3, [Rental Item - Daily Rate], 
    ...

    You need:

    ...
     [Rental Days] >=1 AND [Rental Days] <=  3, [Rental Item - Daily Rate],
    ...

    for that to work.

    However; I urge you to be careful with specific ranges.  If you do not consider all possibilities your code will break.  

    For instance, your solution (with the AND operator) doesn't consider anything less than half a day (or a value between 0.5 and 1),  or 3.5 days, or if someone submits the form without any days (blank), your code will break and the rate will not be set.  Maybe this breaks nothing, maybe everything.  Just be aware.

    Hope this helps sheds some light.

    ~Rob
  • DirkRuana's avatar
    DirkRuana
    Qrew Captain
    Rob,

    That does help!

    I was planning on limiting method of selecting number of days using numeric field in another table.  

    Does that make sense?

    Dirk