How to hide strings if the result is an error

I am making a tracking app with the API of a company, I use a timeline where the events of the package delivery are shown, however the amount of events is not always the same and if I put more strings than there are events, an error is triggered and none of the events are shown in the timeline, I wanted to know if there was a way to hide or delete a string if its value is an error

What you could do is use javascript map function to traverse the array and form the strings.
Having an entry for each response from the API (which could be zero to 10000) is not going to work for you.

example below
forum.json (4.0 KB)

Thank you very much, I already tried it in my app and it worked, I have one last question with this topic, I want to make a table with the info of the shipments and I want one of the columns to show the last event, is there any way to add the last event of the query?

Assuming there are events in the data query and the query returns them in event order (not sure how you'd show a timeline if it isn't) then you'd need to take the first (or last) item from the data array, depending on how it's sorted. eg[0] or[]

This worked, I didn't know how to use length in retool, thank you very much for your help.