Get the most recent collection from array

I’m trying to add cells to Google Sheets from an API request, I need to make it dynamic because it is updated every day.

The only thing I need are the values of capturedTextsCollection 1 Oz Gold USD and 1 Oz Silver MXN but I still get the values of the first collection, how should I setup the modules to obtain the values of the last collection?

Thx in advance

Welcome to the Make community!

Please provide the output bundles of the HTTP module shown in your screenshot by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.
Screenshot_2023-10-06_141025

A.

Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

Uploading them here will look like this:

module-1-input-bundle.txt (12.3 KB)
module-1-output-bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

Providing the input/output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

This will allow others to better assist you. Thanks!

2 Likes

It should be something like this,

{{ toArray(last(map(1.result.robotTasks.items; "capturedTexts"))) }}

To get a more accurate answer, please provide the requested information in the format described in my previous post.

2 Likes

Here are the bundles, let me try with your second answer

module-1-output-bundles.json (18.9 KB)
module-1-input-bundles.json (855 Bytes)

You might not need the toArray if you don’t need the keys, and only want the values.

Output

Screenshot_2024-02-22_110252

3 Likes

Sorry I went afk and forgot to anwser

Ty so much! That worked for me

regards

2 Likes

No problem, glad I could help!

1. If you have a new question in the future, please start a new thread. This makes it easier for others with the same problem to search for the answers to specific questions, and you are more likely to receive help since newer questions are monitored closely.

2. The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep the Community organized.

This marks the topic as solved, so that:

others can save time when catching up with the latest activity here, and

  • allows others to quickly jump to the solution if they come across the same problem

To do this, simply click the checkbox at the bottom of the post that answers your question:
Screenshot_2023-10-04_161049

3. Don’t forget to like and bookmark this topic so you can get back to it easily in future!

2 Likes