0

proper filtering for project status and category

I'm having trouble properly filtering for Project->status and Category.

currently this returns with an error:

shotgun_api.shotgun_3_0_17_src.shotgun.Fault: API read() Task.project expected [Hash, NilClass] data type(s) but got String:
"Archive"

but i'm not sure if project.sg_status_list is correct either

any help with this would be appreciated.



filters = [

['task_assignees', 'is', userInfo[0]],
['sg_status_list', 'is', 'ip'],
['sg_status_list', 'is_not','apr'],
['sg_status_list', 'is_not','fin'],
['sg_status_list', 'is_not','qc'],

['entity.Shot.sg_status_list', 'is_not','fin'],
['entity.Shot.sg_status_list', 'is_not','qc'],
['entity.Shot.sg_status_list', 'is_not','apr'],
['entity.Shot.sg_status_list', 'is_not','dlvr'],
['entity.Shot.sg_status_list', 'is_not','iomt'],
['entity.Shot.sg_status_list', 'is_not','omt'],
['entity.Shot.sg_status_list', 'is_not','na'],
['entity.Asset.sg_status_list', 'is_not','fin'],
['entity.Asset.sg_status_list', 'is_not','omt'],

#broken from here
['project.sg_status_list', 'is_not', 'Archive'],
['category', 'is_not', 'Publish']

]
fields = ['content', 'sg_status_list', 'project_id', 'project_status', 'name', 'code']

assignments = sg.find('Task', filters, fields)
return assignments

4 comments

  • 0
    Avatar
    Manne Öhrström

    Hey there!

    Try replacing project.sg_status_list with project.Project.sg_status_list!

    You can also group together the status filters into fewer ones by using a comma syntax, e.g. ['entity.Shot.sg_status_list', 'is_not','apr,dlvr,na,fin'] 

    Thanks!

    Manne

  • 0
    Avatar
    Kaleb Goulding

    Thanks for the comma syntax! that simplified things quite a bit. project.Project.sg_status_list does not seem to work either. its returning error:

    shotgun_api.shotgun_3_0_17_src.shotgun.Fault: API read() Asset.project.Project.sg_status_list doesn't exist:
    {"path"=>"project.Project.sg_status_list",
     "values"=>["Archive"],
     "relation"=>"is_not"}

     

    for clarification, i attached an image of the two filters in shotgun that i'm trying to replicate in code.

    shotgun_api.shotgun_3_0_17_src.shotgun.Fault: API read() Asset.project.Project.sg_status_list doesn't exist:
    {"path"=>"project.Project.sg_status_list",
     "values"=>["Archive"],
     "relation"=>"is_not"}

  • 0
    Avatar
    Manne Öhrström

    Sorry about the incorrect advice! The status field on Project is called sg_status, try with that instead of sg_status_list

    In the Shotgun web UI, right clicking on a spreadsheet header (in list view mode) and choosing 'configure field' will bring up a UI where you can see what the field code (e.g. sg_status in this case) is for a particular field. 

    Thanks!
    Manne

  • 0
    Avatar
    Kaleb Goulding

    This worked great! thanks for all your help. I'll be certain to use the spreadsheet header info for future reference.

Please sign in to leave a comment.