Discussions

Expand all | Collapse all

IF then syntax Question

  • 1.  IF then syntax Question

    Posted 14 days ago
    Edited by Mike Tamoush 14 days ago
    I know this is simple, but for some reason I can't get the syntax.

    Example Code:

    If(
    [Field A] = true and ([Field B] = "Example1" or [Field C] = "Example2"), "Result A",
    [Field A] = true and ([Field D] = "Example3" or [Field E] = "Example4"), "Result B",
    [Field A] = true and ([Field F] = "Example4" or [Field G] = "Example5), "Result C")

    I suspect there is an easy way to only write the [Field A] = true once, instead of 3 times, but I just can't seem to get it. The above code works, but I think it would be cleaner to not repeat that condition, especially if this ran for 10 lines or something. Thinking just a simple nested if statement, that I keep writing wrong?

    ------------------------------
    Mike Tamoush
    ------------------------------


  • 2.  RE: IF then syntax Question

    Posted 14 days ago
    Here is one way.  Dispose of the field A question first.

    IF(
    not [Field A], "", // if field A is false, then result is blank. (null), else we know that Field A is true so carry on ...
    [Field B] = "Example1" or [Field C] = "Example2", "Result A",
    [Field D] = "Example3" or [Field E] = "Example4", "Result B",
    [Field F] = "Example4" or [Field G] = "Example5, "Result C")




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