# How to Create a Tickets Sold Today Query in Altru for the Barcode Scanner

> Build the Altru sales order query the barcode scanner uses to validate today's tickets: filters, the two required fields, and the save options that matter.

Source: https://socialgoodsoftware.com/how-to-create-a-tickets-sold-today-query-with-altru/
Published: 2020-05-25 · Updated: 2026-11-20

---

[How to Create a Tickets Sold Today Query in Altru for the Barcode Scanner (video)](https://www.youtube.com/watch?v=kQpGU1yxl_E)

The barcode scanner app validates tickets by running an Altru query of today’s ticket sales. Build it in **Analysis › Information library** as an ad-hoc **Sales Order** query, filter it to active tickets that have a ticket number for events starting today, and output the **ticket number** and the ticket’s **system record ID**, which are both required. Save it with **Suppress duplicate rows** unchecked and **Allow all users to run this query** checked so the app can run it.

**Before you start:** you need an Altru login that can create queries. If you don’t have one, ask your system administrator.

## Steps

1. **Start a new query** ([0:38](https://www.youtube.com/watch?v=kQpGU1yxl_E&t=38s)). In Altru go to **Analysis › Information library**, click **Add an ad-hoc query**, choose **Sales Orders** and click **OK**.
2. **Add the filters** under **Include records where** ([1:02](https://www.youtube.com/watch?v=kQpGU1yxl_E&t=62s)):
   - Sales order item › Sales order item ticket › Tickets › **Status** is equal to **Active**, so refunded tickets are left out.
   - Tickets › **Ticket number** is not blank. This one is required, because the app validates against the ticket number.
   - Constituents › Email addresses › **Primary email address** is equal to **Yes**, used to look up guests who forgot their tickets.
   - Sales order item ticket › Program events › **Start date** is equal to **Today**.
3. **Adjust the filters to fit how you work** ([3:03](https://www.youtube.com/watch?v=kQpGU1yxl_E&t=183s)). Drop the email filter if you won’t look guests up by email. If tickets are valid for longer, for example a year, change the date filter (Rick suggests calendar year to date).
4. **Add the results fields** ([3:45](https://www.youtube.com/watch?v=kQpGU1yxl_E&t=225s)): **Lookup ID**, the program event **Name** (a quick check that you have the right program), the constituent’s **Email address**, the **Ticket number** and the ticket’s **System record ID** from Sales order item › Sales order item ticket › Tickets.
5. **Add any fields you want to search by** ([6:07](https://www.youtube.com/watch?v=kQpGU1yxl_E&t=367s)). Every results field shows up in the app’s **Search by** list, so add name or phone number if staff should search on them.
6. **Preview** ([7:18](https://www.youtube.com/watch?v=kQpGU1yxl_E&t=438s)). If nothing has been sold today, the preview is empty; to test, temporarily use some past dates.
7. **Save** ([7:46](https://www.youtube.com/watch?v=kQpGU1yxl_E&t=466s)). Click **Set save options**, name the query (for example *Tickets sold today | Barcode scanner*), uncheck **Suppress duplicate rows** and check **Allow all users to run this query** ([8:04](https://www.youtube.com/watch?v=kQpGU1yxl_E&t=484s)). Then click **Save and close**.

More on the app itself on the [Ticket Scanner](https://socialgoodsoftware.com/features/ticket-scanner) page.

## Common questions

### Which fields are required?

Only two: the **ticket number**, which is how the app turns a scanned barcode into a ticket and checks it’s valid, and the ticket’s **system record ID**, which is how the app tells Altru the ticket was scanned. Lookup ID, email address and event name are optional.

### Why turn off Suppress duplicate rows?

The barcode scanner app catches duplicates on its side, so let the query return every row.

### Why does Allow all users to run this query matter?

It’s how the app is able to run the query on your behalf to pull in new barcodes and sales ([8:10](https://www.youtube.com/watch?v=kQpGU1yxl_E&t=490s)).

### Why is my preview empty?

If no tickets have been sold for today, there’s nothing to show ([7:24](https://www.youtube.com/watch?v=kQpGU1yxl_E&t=444s)).

### Can staff search for guests by name or phone number?

Yes. Add those fields to **Results fields to display** and they appear in the app’s search ([6:36](https://www.youtube.com/watch?v=kQpGU1yxl_E&t=396s)).

## Video transcript

Hey, this is Rick with Social Good Software. In this short guide I’ll show you how to create an ad-hoc query that represents the tickets sold for a program. We have separate queries for programs and memberships, but this one is just for a ticketed program.

You should be able to log in to your Altru account and create a query. If you can’t, contact your system administrator and they’ll set that up for you.

Let’s jump right in. We’ll head into Analysis, then Information library. The first thing we’ll do is click Add an ad-hoc query, go down to Sales Orders, and click OK. This brings up the dialog to create a new ad-hoc query.

We’ll start with the Include records where section at the top and add some restrictions. Go into Sales order item, Sales order item ticket, Tickets, and choose ticket status is equal to Active. Click OK. Then, under the same section, ticket number is not blank, so we only get tickets that actually have a ticket number. Click OK. Next, go to Constituents, Email addresses, Primary email address, and set it equal to Yes. Then go back to Sales order item, Sales order item ticket, Program events, Start date, and set it equal to Today.

Let’s break down what each restriction does. Status equal to Active simply means the ticket is valid and hasn’t been refunded. Ticket number not blank is required, because we need a ticket number to validate against. Primary email address equal to Yes is there because we’ll use email addresses to look up constituents who forgot their tickets, so we need to be sure we’re looking at the right addresses. And start date is today restricts the query to tickets for events happening today.

If you don’t want to look up constituents by email address, you can remove that one. If you don’t want to restrict ticket validation to today, say your tickets are valid for a year, you might change that restriction to calendar year to date. Adjust these depending on how your organization works, but this is a good starting point.

Now the results fields to display. You can adjust these depending on what you want to show. We’ll keep the lookup ID. Then Sales order item, Sales order item ticket, Program events, Name. We use the name to verify we’re selecting the right program: when we preview results, it’s a quick way to see we’re working with the right program. If you have other ticketed programs and want to restrict the query by program name, you’d do that here, but in our case we don’t.

Next, the constituent’s email address: Constituents, Email addresses, Email address. Then Sales order item, Sales order item ticket, Tickets, Ticket number. The ticket number is required, because it’s how we convert those barcodes into the ticket number and verify that the ticket being scanned is valid. Lastly, the system record ID from Sales order item, Sales order item ticket, Tickets. Make sure you add that one; it’s also required, because it lets us tell Altru that the ticket was scanned.

So the two required fields are the ticket number and the system record ID. The email address, program event name and lookup ID are optional, and they’re a handy way to look up constituents.

Now that you’ve selected those fields, you can display additional ones if you like, for example to look people up by name, phone number or email address. Just include the fields you want to search by. Whatever fields you show in the results will appear in the app’s search. Over in the app, if you tap the search bar at the top right, you get Search by, and you can see it’s searching by lookup ID, name, status, start date, price and ticket number. Those all correspond to the fields here. So to add more fields to Search by, include them in the results fields and they’ll show up in the app.

I’m happy with this, so I’ll head to the Preview tab to see the results. Since we’re not currently operating, we don’t have any tickets sold, and that’s okay. If you wanted to test, you could change the filter to some dates in the past.

Now I’ll click Set save options and save the query. I’ll name it “Tickets sold today | Barcode scanner”. You can give it a category and put it in a folder if you like.

This next part is important. Under Options for using this query, make sure you uncheck Suppress duplicate rows. Don’t worry about duplicates; we catch those on the mobile app side. Then, under permissions, make sure Allow all users to run this query is enabled. This is really important, because it’s how the app is able to run this query and pull in any new barcodes or new sales.

Once you’re happy, click Save and close, and that saves your query. That’s all there is to creating an ad-hoc query for the barcode scanner. If you have any questions, reach out. We’re always happy to help.

---

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
