0

Support 'in' filter on status list

I find myself constantly repeating code because I can't search for shots/versions that are in 1 of several statuses easily. As an example, we have both a status for the shot being final ('fin') and the shot being done rendering to the final DPX output ('dpx'). It would be nice to be able to grab the set of shots that are in either of those statuses using a single query. The example I gave here is just 2 statuses, but I usually find myself in a loop of querying (for a version of a shot) for a particular status, not finding one, then proceeding to try the next status out of 4 that are acceptable. Worse yet, I'm doing this for every shot in the scene, for every scene in the movie, so the overhead adds up.

 

['sg_status_list','in',['dpx','fin','finr','stc']]  would be a beautiful thing.

7 comments

  • 0
    Avatar
    KP

    Scott,

    While we don't support having multiple values in a single filter (like your example there), we *do* support multiple filters in a query. So there's no reason you couldn't put together a query like this:

    fields = ['id','code','user'] 
    filters = [['sg_status_list', 'is', 'dpx'],['sg_status_list', 'is', 'finr']]
    result = sg.find("Version", filters, fields, filter_operator='any')

     

    Check out our reference documentation for more info: https://github.com/shotgunsoftware/python-api/wiki/Reference%3A-Methods#find

    cheers,
    kp

    Follow us on Twitter @shotgunsoftware and @shotgunsupport

  • 0
    Avatar
    Scott Pearson

    Thanks, I appreciate the response. That's... kind of helpful. The shortfall is that I actually have 3 things in my filter that MUST be met, and then I'm interested in status being 1 of 4 values. I suppose that means I could create 4 filters, with the first 3 lists in each being the same and only the last differing. Otherwise, filter_operator='any' would give me back a bunch of stuff I didn't want.

  • 0
    Avatar
    katisss

    Similar problem here, interested in matching multiple values (like an or).
    Department is Animation or Layout for example. Has this been solved?

  • 0
    Avatar
    katisss
  • 0
    Avatar
    Stephen Chiu

    Yes, that should work for you! We'd like to have an official solution that integrates with the existing API filter format, which we do have a design spec for right now. We'll keep these threads updated on the progress. We'll also be sure to continue supporting the format detailed in the link above to ensure nothing breaks for anyone out there using that.

  • 0
    Avatar
    katisss

    It would be great to have this, as it would save a lot of data base access.

    Unfortunately the syntax posted there doesn't work for me.
    Is there any working examples around?

  • 0
    Avatar
    katisss
    Never mind, the problem is with the custom wrapper here. If i dont use it it is working
Please sign in to leave a comment.