Someone in the Quickbase community asked a question that comes up a lot with Document Creation. They had a report of material requests, filtered down to one job, and they wanted a single PDF listing just those requests. When they generated the document, it didn't care about the filter. It pulled in requests for the whole table instead.
Here's the original thread: Document Template/Creation (PDF).
The short answer: generate the document from the job, not from the report. Put the template on the Jobs table, add the requests with Report as a customizable table, and choose Filter using report link settings. Each job's PDF then lists only that job's requests, one row per request. The rest of this guide walks through the setup, the button, and a few variations for when you need something other than "all requests for this job".
Why the report filter gets ignored
The thing to know about Document Creation is that a document is always generated from one record. The button (a formula-URL field) sends Quickbase a template ID, a table and a Record ID#. That's it. Nothing about the report you happened to be looking at goes along with it, so the filter you set on screen never reaches the template.
That leads to two common surprises when the template lives on the Material Requests table:
- The button on each report row makes a document for that one request, not for the list you were looking at.
- If the template pulls in a report of requests and isn't filtered to related records, the report shows every record the report returns, which for most reports is every request in the table.
So the question to ask is: which single record do all these rows belong to? Here, it's the job. Make the job the record you generate from, and let the relationship do the filtering.
The example setup
I'll use a simple construction app with two tables:
Jobs (the parent): Job Number, Job Name, Site Address, Project Manager.
Material Requests (the child), related to Jobs:
| Field | Type | Notes |
|---|---|---|
| Item | Text | |
| Qty | Numeric | |
| Unit | Text or multiple choice | ea, box, bucket... |
| Requested By | User | |
| Needed By | Date | |
| Status | Multiple choice | Requested, Ordered, Delivered, Cancelled |
| Related Job | Numeric | The reference field for the relationship |
Job J-2041, Maple Street Remodel, managed by Sarah Lee, has three requests:
| Item | Qty | Unit | Requested By |
|---|---|---|---|
| 2x4 stud, 8 ft | 120 | ea | Mike Chen |
| Drywall sheet 4x8 | 45 | ea | Mike Chen |
| Joint compound | 6 | bucket | Ana Ruiz |
The goal is a one-page "Material Request Sheet" for J-2041 with the job details at the top and those three rows in a table, and nothing from any other job.
Before you start
- You need a relationship. Material Requests has to be a child of Jobs, so each request carries a Related Job. If your requests only have a text field with the job name typed in, set up a proper Jobs to Material Requests relationship first and fill in Related Job on the existing requests (an import or grid edit works well for that). If you don't have a Jobs table at all, create one. It's worth it for this and plenty of other things.
- Check your plan. Document Creation isn't on every Quickbase plan. Recent Document Creation release notes list Business and Enterprise, so check what your account includes if you don't see Document templates in table settings.
- You need to be able to edit the app (table settings, fields and forms).
Step 1: Make a report on Material Requests just for the document
I'd make a separate report for the template rather than reusing one people work with on screen. If someone later adds a column or changes the sort on a working report, every document you generate changes with it.
- On the Material Requests table, create a new table report. Call it something obvious like Requests for Job PDF.
- Add the columns you want printed, in order: Item, Qty, Unit, Requested By, Needed By. Leave out Related Job and anything internal. You can still rearrange things in the template later.
- Set the sort, for example by Needed By, then Item.
- Don't filter it to a specific job. The template will handle that per job.
- If there are requests that should never print, like Cancelled ones, add that as a filter on the report (Status is not Cancelled). This kind of fixed rule belongs on the report, because the template has no other place to get it from.
- Save the report.
Step 2: Create the template on the Jobs table
This is the key move. The template goes on the parent table, not on Material Requests.
- Open the table settings for Jobs and select Document templates. (In the sidebar, the three-dot menu on the table name also has a shortcut to Document templates.)
- Select New template.
- Give it a name, for example Material Request Sheet, and optionally a description.
- Build the header: a title, then the Job fields you want at the top, like Job Number, Job Name, Site Address and Project Manager. Because the template is on Jobs, these are just fields from the record you generate from.
Step 3: Add the requests as a customizable table
- Click where the table should go, below the header.
- From the toolbar, select Add elements, then Report as a customizable table.
- In the Report dropdown, choose the Material Requests table and the Requests for Job PDF report.
- Choose Filter using report link settings. This is the option that limits the rows to requests related to the job you generate from.
- Select Add.
Quickbase inserts a table with a header row and a single row of field references. That single row is a pattern: when someone generates a document, it repeats once for each request the report returns for that job, up to 1,000 records.
The other choice in that dialog, Do not filter for related records, is what produces the "everything in the table" result. It's useful for things like a full price list, but not here.
With the table selected, use the table toolbar to tidy it up: rename header cells ("Requested By" to "Requested by"), adjust widths, merge or insert columns, or open table and cell properties for borders and padding. If you're comfortable in source mode, you can edit the table HTML directly.
Below the table is a good place for a signature line ("Approved by") or notes for the supplier.
Step 4: Preview it against a real job
Select Save and preview, pick a job, and download the PDF. For J-2041 you should see the three requests above and nothing else.
Then try a couple of other cases:
- A job with no requests yet. The table should be empty. If it shows other jobs' requests, the element is set to Do not filter, or the report isn't on the related table.
- A job with a Cancelled request. It shouldn't appear if you added that filter in Step 1.
- A job with a lot of requests. Check that the table breaks onto a second page cleanly.
Step 5: Add a generate button to Jobs
Users generate documents with a formula-URL field that points at the template. Quickbase's help article Generate documents from records in your app has the formula, and it's also on the Exchange as Generate Document.
- Find the template ID: Jobs table settings, Document templates. The ID shows in the template list (and in the Form options section of the template builder).
- On the Jobs table, add a new Formula - URL field. Name it something like Material Request Sheet.
- Paste the formula from the help article, or install it from the Exchange.
- Change
var number templateId = 1;to your template's ID. If it's the only template on the table, it's probably already 1. - Optionally, give each file a useful name instead of the default. For example:
var text fileName = URLEncode("Material-Requests-" & [Job Number]);
- Leave the format as
"pdf"unless you want Word or HTML. (Reports and other Quickbase elements render much better in PDF than in Word.) - Leave
recordId = [Record ID#]andtableId = Dbid()alone. They're what tell Quickbase which job to use. - In the field properties, set it to display as a button with a short label like "Request sheet".
- Add the field to the Job form, and to a Jobs report if people prefer to work from a list.
Now the workflow is: open job J-2041 (or find it on the Jobs report), click Request sheet, and get a PDF of just that job's requests.
If people are used to working from the Material Requests report, put a link to the job on that report (the Related Job, or a lookup of Job Name). They click through to the job and generate from there.
Other ways to send the same document
Once the template exists, you don't have to rely on someone clicking a button:
- Custom emails: the email builder can include a document from a template saved on the table. That's handy for sending the request sheet to a supplier when a job hits a certain status.
- Pipelines: the Quickbase channel has a Generate Document step that creates a PDF or Word file from a record using an existing template. You could generate the sheet when a job is marked "Ready to order" and attach it to the job or send it on.
Either way, it's generated from the Job record, so the same filtering applies.
When you need only some of a job's requests
The template prints every request the report returns for that job. If you need a narrower set, the trick is to put that rule somewhere the template can see it, since an on-screen filter won't get there:
- Fixed rules go on the report. "Only requests not yet ordered" is just a report filter (Status is Requested). Make a second report and a second template if you need both versions.
- Hand-picked rows go in a field. Add a checkbox to Material Requests, like Include on Next Sheet, and filter the template's report on it. People tick the requests they want, generate the job's sheet, and clear the boxes afterwards (a pipeline or a simple button can do the clearing).
- Batches get their own parent. If you regularly send groups of requests that aren't "one job", for example a weekly order to one supplier, create a parent table for those batches (Supplier Orders, say), relate requests to it, and put the template there. Same pattern, different parent.
Troubleshooting
Every job's requests show up. The customizable table is set to Do not filter for related records, or you picked a report from a table that isn't related to Jobs. Delete the table and add it again with Filter using report link settings.
The table is empty. The requests aren't linked to the job (Related Job is blank), or a filter on the report is excluding them. Open the job's form and check that the requests show in its embedded report.
You get one document per request. The template and button are on Material Requests. Move them to Jobs.
Some rows are missing on a huge job. The customizable table stops at 1,000 records. Split the document (by status or date range, using separate reports) if you ever get close.
You'd like totals under the table. Totals like total quantity or cost work best as summary fields on the job, printed under the table with your own labels. I covered that in Labeled Invoice Totals in Quickbase Document Templates, and the same approach works for request sheets.
Old PDFs didn't change. Documents that were already generated and saved keep the layout they had. Only new ones pick up your template edits.
Wrap-up
Documents don't remember report filters. They start from a single record. So pick the record that owns the rows you want, which here is the job, put the template on that table, and add the child report with Filter using report link settings. Each job then gets its own clean PDF of its own requests, and the button sits on the job form where people already work.