No output on Text Parser

Hi,

I’m new on Make & I have an issue on my scenario.
I make a HTTP Request on external API that return me some information. After that I transform the response on Json and now I want :

  1. To extract all “num_records” to the json file.
  2. Make a sum of all the values ​​of the “num_records” fields

But I have a problem because my Text Parser does not return any output… and I don’t understand why ??

Knowing that I use the following pattern which works correctly on regex101 : "num_records\":\s*(\d+)

Bellow, find the text on the json :

“{"cursor":"","hits":3,"results":[{"id":65673,"num_records":14631,"assets":{"ip_addresses":14631,"password":14631,"target_url":14631,"keyboard_languages":14631,"user_sys_registered_owner":14484,"country":14631,"infected_machine_id":14631,"email":7346,"username":7285,"user_os":14631,"user_hostname":14631,"log_id":14631,"infected_time":14631,"country_code":14581}},{"id":65675,"num_records":2602,"assets":{"display_resolution":2602,"ip_addresses":2534,"user_browser":2602,"password":2602,"target_url":2602,"keyboard_languages":2602,"user_sys_registered_owner":2601,"country":2597,"infected_machine_id":2602,"email":943,"full_name":25,"av_softwares":2348,"username":1659,"infected_path":2534,"user_os":2602,"log_id":2602,"infected_time":2602,"country_code":2597,"timezone":2602}},{"id":65677,"num_records":139,"assets":{"display_resolution":139,"ip_addresses":139,"user_browser":139,"password":139,"target_url":139,"keyboard_languages":139,"user_sys_registered_owner":139,"country":139,"infected_machine_id":139,"email":3,"full_name":7,"av_softwares":139,"username":136,"infected_path":139,"user_os":139,"log_id":139,"infected_time":139,"country_code":139,"timezone":139}}]}”

Can you help me to fix this issue and give me some tips for the second step that will sum all value ?

Thank in advance !

Welcome to the Make community!

Could you go to regex101.com, paste in your Pattern at the top and paste a complete/full example text you are trying to match from below it?

Then, save the regex example and share the link with us here.

This will allow others to assist you here with your pattern. Thanks!

Sorry,

Here : regex101: build, test, and debug regex

Thank for your reactivity

I don’t see any issues with the Text Parser. It’s likely something to do with the first three modules instead.

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

1. Relevant Screenshots of first three modules

Please share screenshots of your scenario, any error messages, relevant module fields, and filters in question? It would really help other community members to see what you’re looking at.

You can upload images here using the Upload icon in the text editor:

2. 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.

3. Output Bundles of first three 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!

unfortunately, I cannot share all the information in full because, I work for a company with confidential data… really sorry.

Here is all the data I can give you:


Capture d'écran 2024-10-06 164918

I check if in the database there is a new entry to retrieve a “since” date and a “until” date to transmit in the URL of the HTTP request;



I get the correct results for the given date period


The Json transformation is done correctly with all the elements of the 3 collections of the HTTP request response


The Text Parser retrieves exactly the same content from the output of the previous step (Json)

The pattern transmitted in the text parser is correct since when I copy and paste Input & the pattern on Regex101, it finds 3 results corresponding to the 3 collection received by the HTTP request

despite all this I have no output on my text parser…

Thank in advance to helping me !

Last Modification

My HTTP request returned a structure similar to Json, so I modified my scenario as follows:

  1. I check if a new date “Since” & “Until” are in the database
  2. I pass the dates in the URL of the HTTP request to retrieve the result with the parameter “parse response = yes”
  3. I create a Json and map the results of the HTTP request. At this step, in output, it correctly retrieves all of the collections in a JsonString field
  4. I can now see an output but it is empty.

Below are the screenshots of my scenario.


Capture d'écran 2024-10-06 220529



Hello,

I did a test:
I took the input from the Text Parser step of my scenario and entered it directly into the “text” field of a new Text Parser module. I also copied and pasted my pattern. & that it works when the text is directly in the module but not in my scenario when it comes from a variable from a Json module.

Any ideas to help me?

Thanks in advance!

Incorrect, you do not place the regex delimiter or flags in the pattern:

26eec7911127ece18c5b590ee92996e7599bcb2f

I was able to make it work using the regex you provided:

Screenshot_2024-10-07_211052

Screenshot_2024-10-07_211030

Try it yourself:

Module Export - quick import into your scenario

You can copy and paste this module export into your scenario. This will import the modules (with fields/settings/filters) shown in my screenshots above.

  1. Move your mouse over the line of code below. Copy the JSON by clicking the copy button on the right of the code, which looks like this:

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the editor.

  3. Click on each imported module and re-save it for validation. There may be some errors prompting you to remap some variables and connections.

JSON module export — paste this directly in your scenario

{"subflows":[{"flow":[{"id":230,"module":"util:ComposeTransformer","version":1,"parameters":{},"mapper":{"value":"\"{\\\"cursor\\\":\\\"\\\",\\\"hits\\\":3,\\\"results\\\":[{\\\"id\\\":65673,\\\"num_records\\\":14631,\\\"assets\\\":{\\\"ip_addresses\\\":14631,\\\"password\\\":14631,\\\"target_url\\\":14631,\\\"keyboard_languages\\\":14631,\\\"user_sys_registered_owner\\\":14484,\\\"country\\\":14631,\\\"infected_machine_id\\\":14631,\\\"email\\\":7346,\\\"username\\\":7285,\\\"user_os\\\":14631,\\\"user_hostname\\\":14631,\\\"log_id\\\":14631,\\\"infected_time\\\":14631,\\\"country_code\\\":14581}},{\\\"id\\\":65675,\\\"num_records\\\":2602,\\\"assets\\\":{\\\"display_resolution\\\":2602,\\\"ip_addresses\\\":2534,\\\"user_browser\\\":2602,\\\"password\\\":2602,\\\"target_url\\\":2602,\\\"keyboard_languages\\\":2602,\\\"user_sys_registered_owner\\\":2601,\\\"country\\\":2597,\\\"infected_machine_id\\\":2602,\\\"email\\\":943,\\\"full_name\\\":25,\\\"av_softwares\\\":2348,\\\"username\\\":1659,\\\"infected_path\\\":2534,\\\"user_os\\\":2602,\\\"log_id\\\":2602,\\\"infected_time\\\":2602,\\\"country_code\\\":2597,\\\"timezone\\\":2602}},{\\\"id\\\":65677,\\\"num_records\\\":139,\\\"assets\\\":{\\\"display_resolution\\\":139,\\\"ip_addresses\\\":139,\\\"user_browser\\\":139,\\\"password\\\":139,\\\"target_url\\\":139,\\\"keyboard_languages\\\":139,\\\"user_sys_registered_owner\\\":139,\\\"country\\\":139,\\\"infected_machine_id\\\":139,\\\"email\\\":3,\\\"full_name\\\":7,\\\"av_softwares\\\":139,\\\"username\\\":136,\\\"infected_path\\\":139,\\\"user_os\\\":139,\\\"log_id\\\":139,\\\"infected_time\\\":139,\\\"country_code\\\":139,\\\"timezone\\\":139}}]}\""},"metadata":{"designer":{"x":1418,"y":-1604}}},{"id":231,"module":"regexp:Parser","version":1,"parameters":{"pattern":"\\\"num_records\\\\\":\\s*(\\d+)","global":false,"sensitive":true,"multiline":false,"singleline":false,"continueWhenNoRes":false},"mapper":{"text":"{{230.value}}"},"metadata":{"designer":{"x":1663,"y":-1598},"parameters":[{"name":"pattern","type":"text","label":"Pattern","required":true},{"name":"global","type":"boolean","label":"Global match","required":true},{"name":"sensitive","type":"boolean","label":"Case sensitive","required":true},{"name":"multiline","type":"boolean","label":"Multiline","required":true},{"name":"singleline","type":"boolean","label":"Singleline","required":true},{"name":"continueWhenNoRes","type":"boolean","label":"Continue the execution of the route even if the module finds no matches","required":true}]}}]}],"metadata":{"version":1}}

Note: Did you know you can reduce the size of blueprints and module export code like the above, using the Make Blueprint Scrubber?

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

When I copy and paste your scenario, I have exactly the same result, so it works when I am “local” without data that comes from an HTTP request and is inserted into a json…

But with the request no output…
It’s hopeless :frowning:

What parameter should I check in the modules of the previous steps:

  1. Airtable: to check if a new date is available
  2. HTTP Request: to retrieve data via an external API
  3. Json: I create a json to insert the results of the HTTP request

… Thank you for your help, because I really don’t understand why it doesn’t work

Here are the latest tests I did: Scenario 1: Composite String + Match Pattern = Works!

Scenario 2: Airtable + Composite String (with text retrieved from airtable) + Match Pattern = Works!

Scenario 3: Airtable + HTTP request (I pass the dates in the url) + Composite String (with the “Data” field of the HTTP request) + Match Pattern = NO WORKS :((((((

I finally found the answer.
Here is for those who would be interested:

I disabled the “parse” option in the HTTP request, then I pass the data of the HTTP request in a text, finally I parse everything with the same regex, and everything works!!

1 Like