Jump to content

Recommended Posts

Posted

Hi,
I am struggling with filtering notes. User supplies the project name, shot and task, with optional note label filtering and optional version filtering (for version notes).
Maybe there is a way to directly query that? I do not know how to find out if note has particular label

Thank you

 

self.ftrack_label = self.ftrack_session.query(
                            'NoteLabel where name is "{}"'.format(label)
                        ).first()
notes = []
f_task = self.ftrack_session.query(
    'Task where name is {} and parent.name is {}'
    ' and project.full_name is {}'.format(task, shot,
					  project)).first()
if do_version:
    assets = self.ftrack_session.query(
	'select asset.name, version from AssetVersion '
	'where task_id is "{}" and asset.name is_not '
	'none order by version desc'.format(
	    f_task['id'])).all()

    version_gui = int(version)
    for one_asset in assets:
	version_asset = int(one_asset['version'])
	if version_gui == version_asset:
	    for one_note in one_asset['notes']:
		content = one_note['content']
		_save = False
		if do_label:
		    l = one_note['note_label_links']
		    if self.ftrack_label['id'] in l:
			_save = True
		else:
		    _save = True
		if _save:
		    v = version_matching(content, version)
		    if v is not None:
			notes.append(content)
else:
    for one_note in f_task['notes']:
	_save = False
	content = one_note['content']
	if do_label:
	    l = one_note['note_label_links']
	    if self.ftrack_label['id'] in l:
		_save = True
	else:
	    _save = True
	if _save:
	    v = version_matching(content, version)
	    if v is not None:
		notes.append(content)

 

  • 4 weeks later...
Posted

Hi Jiri,

Thanks for reaching out. And apologies for the delayed response.

In order to directly query the note's label you would first need to know the parent_id or parent_type of the note(s) you want to return

 

cr_notes = session.query('Note where category.name is "Client feedback" and project.name is "<INSERT PROJECT NAME HERE"').all()

version_notes = [cr['parent_type'] == 'AssetVervsion' for cr in cr_notes]

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...