Query Examples

You can use the below query examples with the Python and JavaScript APIs. Where applicable, you can also use these examples as query filters in the ftrack web interface.

Tip: Find more examples in the Python API documentation.

 

Filter out objects based on child tasks

This query will filter out Shot objects where there are two child tasks, one named foo with the status Not started and the other named baz with the status In progress.

Shot where children[Task] any (name is "foo" and status.name is "Not started") and children[Task] any (name is "baz" and status.name is "In progress")

The Shot object is a custom object in ftrack, and we use the any operator to filter on multiple criteria in the children relation. We can also use the [Task] syntax to specify that we are only interested in child objects of type Task.

  • You could also use this kind of example in a Shot Query filter in a Tasks Spreadsheet in the ftrack web interface by removing “Shot where” from the query above.

2022-12-13_10-20-04.jpg

Image: Example of a Shot Query filter in the Tasks spreadsheet.

To access the Query (Shot) filter in the Tasks Spreadsheet/ftrack web interface:

  1. Go to your project's Tasks Spreadsheet.

  2. Open the Add filter drop-down menu.

  3. Choose what you want to filter on (for instance, Shot).

  4. Select Query.

2022-12-13_10-20-25.jpg

 

Query all assets in a project

This query will filter out all AssetVersions published to a particular project.

AssetVersion where asset.parent.project.name is "project_code"
  • You could also use this kind of example in a Query filter in a Versions dashboard or spreadsheet in the ftrack web interface by removing “AssetVersion where” from the above query.

2022-12-13_10-20-51.jpg

Image: Example of a Query filter in the Versions dashboard.

To create the Query filter in the Versions dashboard/ftrack web interface:

  1. Go to your project's Versions dashboard.

  2. Open the Filters menu.

  3. Click + New Filter.

  4. Select Query from the drop-down menu.

2022-12-13_10-21-15.jpg

 

Query all asset versions that have changed status between two dates

When the status changes on a Version or Task object, ftrack records the time of the change. The historical information allows for queries that look for changes to the status over time.

For example, below, we query all asset versions whose status has changed between 2022-10-01 and 2022-10-31.

AssetVersion where status_changes any (date  2022-10-01)  and status_changes any (date <2022-10-31)></2022-10-31)>
  • You could also use this kind of example in a Query filter in a Versions dashboard or spreadsheet in the ftrack web interface by removing “AsseVersion where” from the above query.

2022-12-13_10-21-39.jpg

Image: Example of a Query filter in the Versions dashboard.

Tip: Take also a look at the Filtering using API like queries article.
 

 

 

 
Was this article helpful?
0 out of 1 found this helpful

Articles in this section