Accessing object of 'note_components'
1 1

3 posts in this topic

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.

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

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
1 1