aazim.mohammad Posted October 8, 2016 Report Share Posted October 8, 2016 Hi, What is the best relationship we can use to extract notes from a task in a query? for example: something like, note = session.get('Note where content is "xyz" and parent.name is "something"'.one()) P.S.: I don't want to use 'ID' for extracting particular note. Thanks in advance, Link to comment Share on other sites More sharing options...
Lucas Correia Posted October 10, 2016 Report Share Posted October 10, 2016 Hi, There is no `parent` relationship on notes due to a technical limitation and the fact that notes can be written on multiple entity types (such as tasks or versions). You can work around this issue by rephrasing the query to start with tasks and using the notes relationship. See the example below: note_content_contains = 'xyz' task_name = 'something' tasks = session.query( 'select notes.content from Task ' 'where notes.content like "%{0}%" and name is "{1}"'.format( note_content_contains, task_name ) ) for task in tasks: for note in task['notes']: print note['content'] If you want to include notes on other objects, such as Folders or Shots, change `from Task` to `from TypedContext`. TypedContext is the name of a base entity type which can be used to query all objects in a project hierarchy. Regards, Lucas Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.