# How to Create an Altru Sales Order Query for Tickets Sold Today (for Automated Emails)

> Build the Altru sales order query behind an automated ticket email: output fields, filters for today's unemailed orders, and the save setting that matters.

Source: https://socialgoodsoftware.com/how-to-create-a-sales-order-query-for-tickets-sold-today/
Published: 2020-10-17 · Updated: 2026-11-20

---

[How to create a sales order query for tickets sold today](https://www.youtube.com/watch?v=qexdVIbZNvI)

A **tickets sold today** query answers one question: who bought an admission ticket today that hasn’t been emailed yet? In Altru, add an ad-hoc **Sales Order** query, output the fields your email uses plus the **sales order record**, and filter to individuals with active tickets, today’s transaction date, a blank **note**, your admission program and a refund status of 0. [Email Designer](https://socialgoodsoftware.com/features/email-designer) then sends each order its email.

**Before you start:** write the email first. The fields it shows (first name, event date and time, amount and so on) are the fields this query has to output. This video is one part of [the full automated ticket email walkthrough](https://socialgoodsoftware.com/how-to-create-an-automated-email-from-start-to-end/).

## Steps

1. **Add the query** ([0:48](https://www.youtube.com/watch?v=qexdVIbZNvI&t=48s)). In Altru go to **Analysis › Information library › Add an ad-hoc query**, choose **Sales order** and click **OK**.
2. **Add the output fields** ([1:53](https://www.youtube.com/watch?v=qexdVIbZNvI&t=113s)). From **Constituent**: **First name**, **Lookup ID** and **Email address**. Then the sales order **Lookup ID** and **Transaction date**. From **Sales order item › Sales order item ticket › Program events**: the start date and start time. Then the **Amount**.
3. **Add the sales order record** ([2:46](https://www.youtube.com/watch?v=qexdVIbZNvI&t=166s)). This is how a copy of each email gets attached back to the order in Altru.
4. **Filter to today’s orders** ([3:14](https://www.youtube.com/watch?v=qexdVIbZNvI&t=194s)):
   - **Constituent › Is individual** equals *Yes*.
   - **Sales order item › Sales order item ticket › Status** equals *Active*.
   - **Transaction date** is *Today*.
5. **Only orders not yet emailed** ([3:59](https://www.youtube.com/watch?v=qexdVIbZNvI&t=239s)). Add **Note** is blank. Each email is attached to the sales order as a note, so this returns only today’s orders that haven’t had the email.
6. **Limit it to your admission program** ([4:31](https://www.youtube.com/watch?v=qexdVIbZNvI&t=271s)). **Sales order item › Sales order item ticket › Program events › Name** equals your program, *Museum Admission* in the demo. Use your own program name; check with guest services if you’re not sure.
7. **Exclude refunds** ([5:19](https://www.youtube.com/watch?v=qexdVIbZNvI&t=319s)). **Refund status** equals *0*, which catches anyone who buys and cancels right away.
8. **Preview, name and save** ([5:43](https://www.youtube.com/watch?v=qexdVIbZNvI&t=343s)). The preview may be empty if nothing has sold today. Name it, for example *Ticket sold today*, **uncheck Suppress duplicate rows** ([5:59](https://www.youtube.com/watch?v=qexdVIbZNvI&t=359s)), and click **Save and close**.

## Common questions

### Why uncheck Suppress duplicate rows?

Email Designer catches duplicate rows and merges them for you, so the query can output as many fields as you need.

### Why is my preview empty?

The query only returns orders with today’s transaction date and no note. If nothing has sold today, or every order has already been emailed, there are no rows.

### What does “note is blank” do?

It excludes orders that already have a note. Because each sent email is attached to the order as a note, an order drops out of the query once it’s emailed and never gets a second copy.

### Is there another tickets sold today query?

Yes, a separate guide covers one: [how to create a Tickets Sold Today query with Altru](https://socialgoodsoftware.com/how-to-create-a-tickets-sold-today-query-with-altru/).

## Video transcript

Now we’re going to jump into Altru and create a query. I have a link to a query template you can use, and this template is for our original question: give me everybody who has purchased a sales order item today. It gives you a query example to follow, and it’s the one we’ll use to create the query today.

Step one is to go into Altru and start creating the query. In Altru we go to Analysis, Information library, Add an ad-hoc query. Here we add a sales order query and click OK.

Now that we’ve added the sales order query, let’s look at the query example. It simply outputs the fields our email needs. Our email needs a first name, an email address, a lookup ID, a transaction date, and so on. The email shows this information, so we need to query for it. I’ve included a couple of screenshots with the tree structure already laid out, so you don’t have to start completely from scratch.

We head over to Constituent and grab the first name, the lookup ID and the email address. Then the sales order lookup ID and the transaction date. We also grab the start date and start time, which are under Sales order item, Sales order item ticket, Program events. Then the amount. And then the sales order record. The sales order record is important because it’s how we attach a copy of the email back into Altru.

Looks like we have that information. Going back to our question, give me all the sales orders processed today so we can send the email, this is where we restrict the query. Under Constituent, we make sure this is an actual individual: Is individual equals Yes. Then the status of the order item is active: Sales order item, Sales order item ticket, Status equals Active. Then transaction date is Today, because we want all the orders processed today.

The next item is Note is blank. That simply says this transaction doesn’t have any notes. The notes are just the emails that get sent out and attached to the sales order as a note. So we’re saying: give me all of today’s transactions that we haven’t emailed yet. That’s all that means.

Then we restrict this to museum admission: Sales order item, Sales order item ticket, Program events, Name equals Museum Admission. That says only give me the people who purchased museum admission, not everyone. This might be different for your organization. Whatever program you’re querying for, adjust it to fit. Check with guest services, or look at your programs on the web tab. This is just an example.

Finally, refund status equals zero. That means we don’t email anyone who’s asked for a refund. People don’t usually ask for a refund right away, but it’s nice to include just in case someone buys and cancels right away.

If you click Preview, you’ll see nothing, because right now there are no transactions today. But this is the query we’ll be using, so I’ll name it “Ticket sold today”. Make sure you uncheck Suppress duplicate rows. That’s really important as we work toward having as many output fields as we want: if there are any duplicate rows, Email Designer will catch them and merge them for you. Then click Save and close, and that gives you the email query for tickets sold today. That’s all there is to this query.

---

Social Good Software adds modern checkouts, timed-ticketing calendars, membership portals, and digital membership cards on top of Blackbaud Altru, without replacing it. Book a 1-on-1 demo: https://socialgoodsoftware.com/demo?src=llms · Call 801-822-0183 · hello@socialgoodsoftware.com · Site summary for AI assistants: https://socialgoodsoftware.com/llms.txt
