Convert all data to array after recursion

Describe the problem/error/question

Here i’m using same flow for recursion but at final i want all the data as a array data that is to convert those as a csv file format. and once if the condition is true i want to convert all the data as a csv which i have received

What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hello @Harikarthik_P_G

The easiest method is to use a Loop node

1 Like

Hello @barn4k , You are correct But i don’t know where and how to use that
Will you help me for that

Hi @Harikarthik_P_G

If I understand your issue correctly, the problem is that you are retrieving the data but you cannot combine them into a single array. The looping is fine. The items are split across different runs and so cannot output a single csv file.

This is a good usecase for new data tables feature.

Simply split the workflow into two steps.

  1. write all the urls into a single database
  2. read all the urls and query them then convert

Here’s your workflow split into two such phases

This is what it looks like in the Data Tables page

2 Likes

Hello @Harikarthik_P_G , how are you?

Try this, I think it’s what you need:

If this helped you, mark this answer as the solution.

1 Like

This uses the global workflowStaticData object to store the URLs within the workflow, not externally. Then they are used to scrape the contents. Please run it on your end and you will see that all 6-7 items get written to 1 single CSV file at the end.

Mark as Solution if it helped :slight_smile:

2 Likes

Hey, the issue is generally that the nodes get overwritten with each loop - currently you will produce just 2 outputs - one for True (which is the latest one because it overwrote all previous ones) and one for False. Both of these get merged and will reach the end.

The problem to solve is how to not lose the outputs from the loops between the first and the last - check my flow to see how I ensure those persist :wink:

1 Like

Hey @Mutasem
Thanks for your response. May i know the configuration details of Get rows and Insert rows nodes in your workflow

Hello @gabrielhmsantos ,
I doing good. Thanks for you response But your workflow is not working for me. Because the aggregate node at last is only returning the first set of values. But i need all the set if values till the condition is false

Hello @krisn0x ,
Thanks for your solution, Now the flow is working fine and the output is looking as i expected

Make a note, that static data is generally the worst method for such a case. Because if you have a lot of data, you will easily overflow the database and your n8n instance will die. If that happens, the only way to restore n8n would be to manually remove the static data from the database.

Another issue is that on the next run it will grab the previous URLs, which may be not valid anymore.

I’ve added a clean-up node in the end

2 Likes

Appreciate the tips here :right_facing_fist: :left_facing_fist:

Hey @krisn0x ,
Now i came with new issue😁.
I got a csv file as a output but the problem is when i open that in a local Excel it is looking like

Where as if i open that in a online csv viewer it is looking good

What will be the problem

Hey @barn4k , Thanks for your response

I think it’s because of the description parsing.

Don’t open the CSV file directly in Excel. Instead, open Excel, choose Data > From Text/CSV, then select the desired CSV file and use the import button to properly load it into Excel

Ohh.. Okay @barn4k Now its working..! Thank you :right_facing_fist: :left_facing_fist:.

Hey @krisn0x ,

Your workflow with like “https://veludharan.blogspot.com/” is executing around 2hrs but still i haven’t get any output is there any other way to resolve this

Hey, it looks like it stuck somewhere (on my end it doesn’t). Can you also try running this version again:

Let me know how it goes,

@krisn0x No No your Workflow is working fine. But the problem is when i give a link “https://veludharan.blogspot.com/” (There is too many html pages than a older link) It is taking too many time and i haven’t get any result.

Let me also test this. But its’s important that you use the latest flow, with @barn4k ‘s fix because otherwise your instance can crash, ok?