RE NXT Query Webinar - Level Up Your Blackbaud RE NXT Queries

Hi, I signed up for this but didn't get a chance to see it “live”, so I just watched the replay.

Intent of this post is to help those that may be thinking the same question as I have previously got asked before.. do i need paranthesis? I thought it would be best if the session actually went into a query that NEED to use paranthesis and situation where “nested” paranthesis is needed and how to handle so others can get more advanced with their querying.

This is the criteria that was demo-ed

f1439bf85041395958ca40630c9aefdb-huge-im

in simple terms, the query is like: A OR (B AND C AND D AND E) OR (F AND G) OR H
where
A is the total amount of gifts_1 ≥ $5000
B is the Gift amount ≥ $1000
C is the GIft Date = this calendar year
etc

While I understand why the intructor did this to make it easier to understand (I did skip some minutes at the end of the meeting, so I don't know if the instructor actually mention it or not), and “maybe” a good practice (maybe b/c paranthesis may be better use when truly needed on very complex criteria), this query is the same as:

A OR B AND C AND D AND E OR F AND G OR H

without any paranthesis. As logic OR is like + (addition) in math and AND is like * (multiplication) in math…

A OR (B AND C AND D AND E) OR (F AND G) OR H is like 1 + (2 * 3 * 4 * 5) + (6 * 7) + 8

A OR B AND C AND D AND E OR F AND G OR H is like 1 + 2 * 3 * 4 * 5 + 6 * 7 + 8

since math order of operation (logic order of operation) is multiply (AND) before addition (OR), even without the paranthesis, 2 * 3 * 4 * 5 and 6 * 7 will be calcuated first before they get added together. screenshots from excel to proof this point:

81950fd43558ea2abfaf553b651db6cd-huge-im
bd41e43250cd9db5da66469857c54f5d-huge-im

Comments

  • @Alex Wong

    This is a great breakdown of parentheses and And/Or! It's something that has had a big learning curve for me but thinking about it in this way makes it much easier to comprehend.

  • @Alex Wong:

    Hi, I signed up for this but didn't get a chance to see it “live”, so I just watched the replay.

    Intent of this post is to help those that may be thinking the same question as I have previously got asked before.. do i need paranthesis? I thought it would be best if the session actually went into a query that NEED to use paranthesis and situation where “nested” paranthesis is needed and how to handle so others can get more advanced with their querying.

    This is the criteria that was demo-ed

    f1439bf85041395958ca40630c9aefdb-huge-im

    in simple terms, the query is like: A OR (B AND C AND D AND E) OR (F AND G) OR H
    where
    A is the total amount of gifts_1 ≥ $5000
    B is the Gift amount ≥ $1000
    C is the GIft Date = this calendar year
    etc

    While I understand why the intructor did this to make it easier to understand (I did skip some minutes at the end of the meeting, so I don't know if the instructor actually mention it or not), and “maybe” a good practice (maybe b/c paranthesis may be better use when truly needed on very complex criteria), this query is the same as:

    A OR B AND C AND D AND E OR F AND G OR H

    without any paranthesis. As logic OR is like + (addition) in math and AND is like * (multiplication) in math…

    A OR (B AND C AND D AND E) OR (F AND G) OR H is like 1 + (2 * 3 * 4 * 5) + (6 * 7) + 8

    A OR B AND C AND D AND E OR F AND G OR H is like 1 + 2 * 3 * 4 * 5 + 6 * 7 + 8

    since math order of operation (logic order of operation) is multiply (AND) before addition (OR), even without the paranthesis, 2 * 3 * 4 * 5 and 6 * 7 will be calcuated first before they get added together. screenshots from excel to proof this point:

    81950fd43558ea2abfaf553b651db6cd-huge-im
    bd41e43250cd9db5da66469857c54f5d-huge-im

    It is interesting, thank you for sharing! In one of the trainings I did a little while ago the instructor said when you have both AND & OR in a query you have to use parenthesis. Your example is the proof you don't always have to. I will use your tip of treating OR as addition, and AND as multiplication going forward. But I am wondering, what would a similar scenario need to be for it to require parenthesis? Wouldn't the ‘math logic’ be applied to all cases thus rendering the parenthesis unnecessary?

  • JoAnn Strommen
    JoAnn Strommen Community All-Star
    Tenth Anniversary Kudos 5 Raiser's Edge NXT Fall 2025 Product Update Briefing Badge First Reply

    @Lena Payne Yes, there may be cases where ( ) are not needed. If using both AND and OR in criteria my experience is that order and placement of ( ) make a difference in the records the query pulls. Test it and see if your results are different.

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 Facilitator 3 Raiser's Edge NXT Fall 2025 Product Update Briefing Badge
    edited October 11

    @Lena Payne
    Yes, there are definitely cases where parenthesis is absolutely needed, the following is a simple case of when parenthesis is needed, as they are completely different without it.

    • (A + B) * C
      • (1 + 2) * 3 = 9
    • A + B * C

      • 1 + 2 * 3 = 7

    Sample Raiser's Edge logic:

    • A = constituent from Preferred Address State = NY
    • B = constituent having a specific assigned appeal (i.e. DIN24NY, new york gala dinner of 2024)
    • C = constituent who gave $1000 or more in 2024

    in query criteria logic:

    • (A or B) and C
      • you will get everyone from NY or they have DIN24NY as assigned appeal, however, ONLY those that gave $1000 or more in 2024 will be in the list
    • A or B and C

      • you will get everyone from NY, regardless of how much given in 2024 PLUS you will get those with assigned appeal of DIN24NY that gave $1000 or more in 2024
  • @Alex Wong great examples, thank you!