1

Quering find with a list?

Hi!

I am trying do an effective sg.find for shots, but only for active projects. Heres what I`m thinking so far.

 

all_projects = sg.find("Project",filters=[['sg_status', 'is_not', 'Archive'],['name', 'is_not', 'Template Project']],fields=['name'])

all_shots = sg.find('Shot', filters=[['sg_status_list', 'is_not', 'omt'], ['project', 'is', all_projects ]], fields=['project', 'code','sg_sequence']])

 

Tried a couple of ways to give the "project is" line a list, but its always expecting some [Hash, NilClass].

Is this a stupid way to do this?

Still quite new to python, so any help is greatly appreciated.

2 comments

  • 0
    Avatar
    Marc Dubrois

    you can use this syntax

    filters = [['sg_status_list', 'is_not', 'omt'], ['project.Project.sg_status','is_not', "Archive"], ['project.Project.name','is_not', "Template Project"]]
    fieldsReturn = ['project', 'code','sg_sequence']
    all_shots = sg.find('Shot',filters, fieldsReturn)

  • 0
    Avatar
    ivarrystad

    That works just awesome! Thank you very much for a great and quick reply!

    This will solve alot of problems!

Please sign in to leave a comment.