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

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:


Comments
-
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.
1 -
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

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
etcWhile 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:


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?
0 -
@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.
1 -
@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
0 - (A + B) * C
-
@Alex Wong great examples, thank you!
0
Categories
- All Categories
- 6 Blackbaud Community Help
- 206 bbcon®
- 1.4K Blackbaud Altru®
- 394 Blackbaud Award Management™ and Blackbaud Stewardship Management™
- 1.1K Blackbaud CRM™ and Blackbaud Internet Solutions™
- 15 donorCentrics®
- 357 Blackbaud eTapestry®
- 2.5K Blackbaud Financial Edge NXT®
- 646 Blackbaud Grantmaking™
- 561 Blackbaud Education Management Solutions for Higher Education
- 3.2K Blackbaud Education Management Solutions for K-12 Schools
- 934 Blackbaud Luminate Online® and Blackbaud TeamRaiser®
- 84 JustGiving® from Blackbaud®
- 6.4K Blackbaud Raiser's Edge NXT®
- 3.6K SKY Developer
- 242 ResearchPoint™
- 117 Blackbaud Tuition Management™
- 165 Organizational Best Practices
- 238 The Tap (Just for Fun)
- 33 Blackbaud Community Challenges
- 28 PowerUp Challenges
- 3 (Open) Raiser's Edge NXT PowerUp Challenge: Product Update Briefing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports+
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Email Marketing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Gift Management
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Event Management
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Home Page
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Query
- 777 Community News
- 2.9K Jobs Board
- 53 Blackbaud SKY® Reporting Announcements
- 47 Blackbaud CRM Higher Ed Product Advisory Group (HE PAG)
- 19 Blackbaud CRM Product Advisory Group (BBCRM PAG)

