Before you open Altru, write down the question your query should answer, the data you need and how it should be presented, and any joins or exclusions. Then build it in Altru, splitting it into several queries if that’s easier, test it on one known sales order first, and keep testing until the results are right. This is a short set of tips, not a full query course; Blackbaud has its own training for learning queries from scratch.
Tips from the video
- 0:32 Start with your question. Before logging into Altru, write down what the query should answer. The example: send an email for every general admission ticket bought online, over the phone or in person.
- 1:34 Define the question for any query. The same habit applies to every query, not just timed ticketing. Here it becomes “everyone who has purchased a general admission ticket today.”
- 1:55 Plan the data and how it’s presented. If you’ve already drafted the email, you already know which fields you need.
- 2:12 Work out joins and exclusions on paper. For example, joining sales orders, or excluding advance sales, group sales or daily sales.
- 2:45 Build the query in Altru. Turn your notes into an actual query.
- 2:55 Multiple queries are fine. You don’t have to get everything into one query; Social Good Software can join them.
- 3:08 Be patient finding fields. Altru sometimes nests fields four, five or six levels deep.
- 3:27 Start with one sales order. Query for one record you know, check the output matches what you expect, then open it up to everyone.
- 3:54 Test, then test some more until you’re happy with the results.
Common questions
Do these tips only apply to ticket emails?
No. Rick uses a timed-ticketing email as the example, but defining the question, the data and the exclusions first works for any Altru query.
What kinds of exclusions should I plan before building?
Anything that shouldn’t be in the results. The video mentions excluding advance sales, group sales or daily sales, and joining different sales orders.
What does the finished query from this example look like?
See how to create a sales order query for tickets sold today, which builds it field by field, and the full automated ticket email walkthrough this clip comes from.
Video transcript
If you’ve never used queries before, I have a little crash course for you. This isn’t meant to teach queries from scratch; Blackbaud has its own training for that. What I’ll do is give you some tips and tricks on how to think about writing queries, so you can become great at writing, adjusting and modifying them, and think on your own about what you need the query to do.
Before you write the query, before you even log into Altru, I highly recommend starting with the questions you want this query to answer. For us it’s simple. The one we’re creating now is for timed ticketing. More specifically, we want to send an email for every transaction over the phone, online and in person. That’s the query we’re writing for: everyone who has purchased an admission ticket online, over the phone or in person gets this email. So my question is, can we deliver an email to everyone who has purchased general admission? Then you go through the process of actually creating the query in Altru, and the last step is creating the specific query, which will be a sales order query.
Let’s take a quick look. Again, this isn’t to teach you queries from scratch, just some tips and tricks I’ve learned over the last couple of years of using Altru. Like I said, take a few minutes and define the questions you want your queries to answer. This doesn’t just apply to timed ticketing; it applies to any query. Write down your question. In our example, it’s: give us everyone who has purchased a general admission ticket today.
Then think about the data you’ll need and how you’d like it presented. We already worked through that when we worked out our email. Here’s our email, and we’ve already typed out the information we need, so we’re one step ahead.
Then work through any joins or exclusions on paper before writing the query. If you’re joining two different sales orders, or doing exclusions, write them down. For example, if you want to exclude advance sales, group sales or daily sales, take a few minutes and write down your notes. When you go to write the query, it’s a lot easier and you have these things top of mind.
So start with your questions. Once they’re done, it’s time to get your hands dirty and write the query in Altru, converting the ideas you have on paper into actual queries. Keep in mind it’s okay if you need to create multiple queries. You can always join them together with Social Good Software, so don’t think you have to get everything right in one query. You can break it up into several.
Another note: be patient as you find the fields you’re looking for. Sometimes Altru has things nested four, five or six levels deep, and it can get a little frustrating. Just be patient, work through the process, find the fields, and be patient with yourself.
You should usually start with one sales order and make sure your output matches the expected output. Instead of querying for everyone, query specifically for one record you know has purchased a sales order. Once you feel comfortable with that, open the query up to everybody else. I typically start with one row just to make sure the output is what we expect.
The last tip I have for you is test, and then test some more. If you’re not sure you’re getting the right data, test and test again until you’re happy with the results.
