Hi @aitrdae,
This should do the trick:
filters = [
{
"filter_operator": "any",
"filters": [
{
'filter_operator': 'all',
'filters': [
['sg_status_list', 'is', 'cmpt'],
['task.Task.step.Step.short_name', 'is', 'rig']
]
},
{
'filter_operator': 'all',
'filters': [
['sg_status_list', 'is_not', 'null'],
['task.Task.step.Step.short_name', 'is', 'mdl']
]
}
]
}
]
sg.find('Shot', filters)
In your filters
list, each filter that is usually a list of three items (a path, a relation and a value) can be replaced by a dictionary that describes a filter group. If you use the dictionary syntax for a filter group, you can specify a logical operator to use (‘any’ or ‘all’) for the filters in that group. Each filter in the group can then in turn, be a list or a dictionary that allows you to specify a nested group.
You could simplify the above example by using the filter_operator
argument of the find()
method, like so:
filters = [
{
'filter_operator': 'all',
'filters': [
['sg_status_list', 'is', 'cmpt'],
['task.Task.step.Step.short_name', 'is', 'rig']
]
},
{
'filter_operator': 'all',
'filters': [
['sg_status_list', 'is_not', 'null'],
['task.Task.step.Step.short_name', 'is', 'mdl']
]
}
]
sg.find('Shot', filters, filter_operator='any')
Let me know if this helps.