How to reference upload file button when component inside list view?

Hello!

I have a list view (listViewMetadataLessons) that contains text area and button to upload a lesson cover image. Each lesson has explanation and cover image.

But when I try to access fileButtonUploadLessonCoverImage inside my S3 query uploadLessonCoverImageS3 I got the next problem:

How should I cope with this problem?

Hello!

Where are you calling this uploadLessonCoverImageS3 action from? If possible, based on how Retool seem to want you to do things, can you move the upload action to be tied to a component/button in the List View objects?

Then, you should be able to use the Run Script event handler to trigger your upload query using an additional scope element for the fields in the uploadLessonCoverImageS3 query.

I'm calling uploadLessonCoverImageS3 from the file button, my file button is linked to the List View.

How can I tie upload action to component in the List View? It is a general query, I trigger it in the event handler.

Should I trigger it through code with additionalScope like this? But the S3 query seems that don't have .trigger() function.

I think in this change event handler you would Run Script and use:

uploadLessonCoverImageS3.trigger({
additionalScope: {
    fileType: theTypeDataFromTheListViewInstance,
    base64: theBase64DataFromTheListViewInstance
    }
})

You should be able to reference the List View instance data using the item variable in this event.

fileType: item.type, //or however your listview is reporting the type
base64: item.base64Data //or however your listview is reporting the data