Use an independent subquery join when a document export query needs values from an organization contact or another dataset record and no standard Document base join is available. This pattern is commonly used when custom document file names or index files need dataset-scoped values.
⭐ Get Inspired
This article was adapted from a post by Technolutions staff in the Slate Community Forums' Get Inspired space. Have a great idea for a Get Inspired post? Let us know!
When to use this
The query base is Document or Document Export.
The needed value lives on an organization contact, standard dataset record, or custom dataset record.
The document has a one-to-one relationship with the dataset row you need to return.
📝 Note
This article describes a query-building pattern. Confirm the relevant GUID relationship in your own query before using the joined values in production exports.
Add an independent subquery join
Open the document export query.
In the joins section, select the subquery join option.
Configure the join with these settings:
Name: Enter a clear name, such as Organization Contact.
Type: Independent Subquery.
Category: Records.
Base: Select Organization Contacts, or select the custom dataset base you need.
Connect the independent subquery to the document
Inside the independent subquery join, add a subquery filter.
Configure the filter as a dependent subquery.
Set the aggregate to Comparison.
Set the operator to =.
Add one export for the document record GUID.
Add one export for the GUID from the independent subquery base.
Select those two exports as Field 1 and Field 2 in the comparison filter.
Save the filter and the join.
After the join is saved, the query can use fields from the organization contact or dataset row as exports, filters, and additional joins.
Use the joined values
Once the independent subquery join is available, you can use the joined dataset fields for tasks such as:
Adding dataset values to an index file.
Building a custom
pdf:fileexport for document file names.Filtering the document export by values on the related dataset record.
Adapt the pattern for custom datasets
To join from a document to a custom dataset, use the same structure but select the custom dataset as the independent subquery base. Then compare the document record GUID to the dataset row GUID or other stable relationship value that connects the two records.
Test before scheduling the export
Run the query for a small, known set of documents.
Confirm that each returned document is associated with the expected organization contact or dataset row.
Confirm that the joined values are populated in the file name or index exports.
Only then configure or resume a scheduled export.