Is possible to fill s3 key from query?

Hi, how can I fill s3 file key input from JS query with data to read a file its really necessary. Thanks

I usually list all files in the bucket and then get the Key from there
You need to add a bucket name

Have you configured s3 properly?

No, I have another case I have some keys in retool database and I loop through some keys and I want to get body of each keys I loop through, the list all files from bucket does not provide Body for each item so what I want first to fill the s3 file key input with keys I loop through for each key trigger the s3 read file for each key to get their body I have saved in base64 format (pdf)
ps: the keys that are looped from database are also available in s3 bucket

The code but is not working properly If i have three items to loop through I'm getting the same body for each item so the state is causing problem with query to read single file from s3 let invoiceNums = [];

generatedFiles.forEach((file) => {
let invoiceNum;

if (file.invoiceNumber.startsWith('23') && file.invoiceNumber.charAt(2) === '8') {
invoiceNum = storno/${file.invoiceNumber}.pdf;
} else {
invoiceNum = invoices/${file.invoiceNumber}.pdf;
}

invoiceNums.push(invoiceNum);
// Here, you can perform other operations with the invoiceNum value if needed.
});
console.log(invoiceNums)

// Assuming you want to set the state1 value and log each invoiceNum separately
invoiceNums.forEach((invoiceNum) => {
state1.setValue(invoiceNum);
query36.trigger();
console.log(query36.data.Body)
// zip.file(${file.guid}.pdf, query36.data.Body, { base64: true });
});

S3 file key: {{sate1.value}} this is causing the same body to go for example for 3 items

But you are overwriting the invoiceNum when running through that forEach statement. - is that whaat you want to do?

Yes for example i have three invoices number I want take invoice number 1 and go get his body then go get invoice 2 get his body etc

Try checking the box Keep variable references inside the query in sync with your app. under Advanced tab

Do you have any specific taks you solved same as my problem?

If you can elaborate a little bit more it would be useful

Hit this link - unfortunately I don't have more time to elaborate at the moment but I have replied to a few posts and even asked some questions myself about s3.... the link should show you all of my posts related to s3

Can I know how you filled s3 file key input at readEachFileToAddToZip what should I set here

I'm having an issue the s3 file key is empty

When you run the listAllFilesForZip on it's own, does that work, and if so what does that look like?

I didn't know It needed to write into s3 file key input {{Key}} as it is on additionalScope