Jump to content

Accessing object of 'note_components'


aserjogin

Recommended Posts

Hello,

I am quite new to the API, which is why I decided to ask for help on the forum. (Sorry, if it is a stupid question...)  Is there a way to access the <ftrack_api.collection.Collection object at ...> in order to retrieve something like a pair of component_id and note_id? So I could check whether the attachment is present on a note or not?

I am trying to access the object via querying a note with certain content.

Here is a short example:

some_note = s.query('Note where content is "let there be something written in here"').one()

some_note['note_components'] - results in me getting an object.

Is there a way to get more out of it? I am sure there is, but I have no idea.

 

Thank you in advance!

Best Regards, Anton.

Link to comment
Share on other sites

7 hours ago, Mattias Lagergren said:

Hi and welcome to the forum.

The Collection object that you get can be accessed much like a list:


for note_component in some_note['note_components']:
	...

some_note['note_components'][0]

et.c

 

Thanks for the welcome :)

Now I get it... either I receive NoteComponents or NoneType objects (if there are no attachments). Should have been more attentive.

I appreciate for taking your time and helping me out, thanks a lot!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...