How can I split these elements into 2 columns and 7 lines?

Describe the issue/error/question

Im new into n8n and Javascript, and I need to split these 7 elements into 2 columns. (ex: “validade_ourives” in one column and “12-04-2024” on the second one. On the other line: "validade_laser in one column and “{VALIDADE_LASER}” on the second one and goes on to the 7th line)

What is the error message (if any)?

Please share the workflow

(Select the nodes and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow respectively)

{
“meta”: {
“instanceId”: “44cc72d17c20cc2eb17f1ce8a1f6709bbddf8ea18788ab52cc3840dfa276f38b”
},
“nodes”: [
{
“parameters”: {
“httpMethod”: “POST”,
“path”: “127a6982-f87e-43b3-afae-06297f7947eb”,
“responseMode”: “lastNode”,
“options”: {}
},
“id”: “9e7cfe96-c991-4d41-b9d3-c5f3207c8d08”,
“name”: “Calcula quantos dias para acabar o curso”,
“type”: “n8n-nodes-base.webhook”,
“typeVersion”: 1,
“position”: [
-1080,
600
],
“webhookId”: “127a6982-f87e-43b3-afae-06297f7947eb”
},
{
“parameters”: {
“functionCode”: “let results = [];\n\nfor (item of items) {\n for (key of Object.keys(item.json)) {\n results.push({\n json: {\n node: key.split(",")[0],\n score: key.split(" ")[0]\n \n }\n })\n }\n}\n\nreturn results;”
},
“name”: “Function”,
“type”: “n8n-nodes-base.function”,
“typeVersion”: 1,
“position”: [
-400,
600
],
“id”: “99934cdf-06d4-42d5-bbbb-7e53a64d242e”
},
{
“parameters”: {
“values”: {
“string”: [
{
“name”: “data_inicio”,
“value”: “={{ $json.body.data_hoje }}”
}
]
},
“options”: {}
},
“id”: “b1fafdb0-9288-4d7c-9293-a61045b70c92”,
“name”: “Set1”,
“type”: “n8n-nodes-base.set”,
“typeVersion”: 1,
“position”: [
-920,
600
]
},
{
“parameters”: {
“operation”: “aggregateItems”,
“fieldsToAggregate”: {
“fieldToAggregate”: [
{
“fieldToAggregate”: “body”
}
]
},
“options”: {}
},
“id”: “a7b04992-611f-457f-916b-ee9196ee37d0”,
“name”: “Item Lists”,
“type”: “n8n-nodes-base.itemLists”,
“typeVersion”: 1,
“position”: [
-760,
600
]
},
{
“parameters”: {
“fieldToSplitOut”: “body”,
“options”: {}
},
“id”: “21c3489e-f128-412c-8603-15686e596982”,
“name”: “Item Lists1”,
“type”: “n8n-nodes-base.itemLists”,
“typeVersion”: 1,
“position”: [
-600,
600
]
}
],
“connections”: {
“Calcula quantos dias para acabar o curso”: {
“main”: [
[
{
“node”: “Set1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Set1”: {
“main”: [
[
{
“node”: “Item Lists”,
“type”: “main”,
“index”: 0
}
]
]
},
“Item Lists”: {
“main”: [
[
{
“node”: “Item Lists1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Item Lists1”: {
“main”: [
[
{
“node”: “Function”,
“type”: “main”,
“index”: 0
}
]
]
}
}
}

Hi @Seiji_H3N, welcome to the community :tada:

I am sure we can figure this out. Unfortunately it seems you didn’t include example data in your workflow though. Any chance you can share the JSON data you currently have and the data structure you’d like to see instead?

Oh, I already have deleted the Flow and tried another (not smart) logic and worked. I still want help to get the best solution, but for now guess I messed up. :frowning:

Glad to hear you found another way to do this @Seiji_H3N. If you need help transforming your data structure, just give me an example of what you have and what you want and I’ll be happy to give it a try :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.