Filtering JSONs

Hi

I have the following scenario (the router is because I removed a branch unnecessary for no):

This scenario outcome is a list of IDs that I need to store using Google Sheets.

But my JSON has many items (more than 2k!) and I only need some of them. I need items in which the description (field texto) contains specific terms.

I tried to add a filter between the Iterator and the Array Aggregator, like this:

But it didn’t work. I got this from Make, from the Google Sheets module.

Function ‘prepareBodyForInsert’ finished with error! Cannot read properties of undefined (reading ‘match’)

Any idea what I did wrong?

Thanks! :slightly_smiling_face:

Welcome to the Make community!

To allow others to assist you with your scenario, please provide the following:

1. Scenario Blueprint

Please export the scenario blueprint file to allow others to view the mapped variables in the module fields. At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.

2. Output Bundles of Modules

Please provide the output bundles of the modules 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”.

A. Upload as Text File

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

B. Insert as Formatted Code Block

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles.
These are the two ways to format text so that it won’t be modified by the forum:

  • Method 1: Type code block manually

    Add three backticks ``` before and after the content/bundle, like this:

    ```
    content goes here
    ```

  • Method 2. Highlight and click the format button in the editor

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.

Following these steps will allow others to assist you here. Thanks!

Done, @samliew

I have changed a few things in the scenario because it evolved.

Here are the files:
Blueprint:
blueprint.json (39.9 KB)
Outputs:
ficha.txt (1.8 MB)
iterator.txt (3.1 MB)
array-agreggator.txt (66 Bytes)
bundle7.json (12 Bytes) (google sheets)

One more thing…

Not sure if this is the right way to create the filter, but…

The filter should be eleicao AND (R.G.E. OR A.G.O.)

You will have to do it this way:

eleicao AND R.G.E.

OR

eleicao AND A.G.O.

unless you use the match pattern operator

eleicao
AND

Text operators: Match pattern
^(R.G.E.|A.G.O.)$

2 Likes

@samliew makes total sense your filter approach! thanks.

Hey @samliew, do you think it’s possible to configure the scenario as I was expecting?

Or should I take another path?