Getting Started

 View Only
  • 1.  Function firing when BOTH conditions are true?

    Posted 11-05-2020 18:16

    Hello!

    I have been trying to find an answer on these boards but can't seem to pin down the right search terms. I have a function that I would like to fire only when multiple conditions are both met. This is for calculating a price per unit where my conditions are [Supplier]="Supplier A" and [Premium unit]=TRUE.

    My current formula is
    If(
    [Premium unit]=true,
    [Unit count]*20)

    This only tackles half of the issue, as the price (20) changes per supplier. I cannot figure out how to add the second condition of the supplier being equal to supplier A. The [Premium unit] field is a checkbox and the [Supplier] field is a multiple choice dropdown. As a bonus question, could I in the same formula change the values for Supplier B?

    Thanks for any help!



    ------------------------------
    Greg Vasilion
    ------------------------------


  • 2.  RE: Function firing when BOTH conditions are true?

    Posted 11-05-2020 18:24
    It's actually not good practice to program the prices into a formula for a few reasons.  The right way to do this is really to have table of suppliers with their prices and then have a relationships where 1 supplier has many "orders".  Then lookup the price.  You would then actually want to use what is called a snapshot field to freeze the value of that lookup since when the prices change you do not want all your historical orders to change their price.

    But f you did want to hard code the pricing
    IF(
    [Supplier] = "Supplier A" and [Premium unit]=true, [Unit Count]  * 20,
    [Supplier] = "Supplier A" and [Premium unit]=false, [Unit Count]  * 18, //  non premium is less expensive
    [Supplier] = "Supplier B" and [Premium unit]=true, [Unit Count]  * 21, // supplier B is a bit more expensive.
    [Supplier] = "Supplier B" and [Premium unit]=false, [Unit Count]  *20) // two slashes mean a comment






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



  • 3.  RE: Function firing when BOTH conditions are true?

    Posted 11-05-2020 18:55
    It's that easy! Thanks Mark, I agree on the price programming, I altered the variable from what we're actually using, this is for a pretty special case. Thank you!

    ------------------------------
    Greg Vasilion
    ------------------------------