Does someone can inform how I can use map or flatmap into Function Node?
If I understood correctly you want to map this:
{
"code": 886079657,
"codinterger": "1377",
"fullname": "ACME",
"tags": [
{
"tag": "Supplier"
},
{
"tag": "testA"
},
{
"tag": "testB"
},
{
"tag": "testC"
}
],
"type": "N"
}
To this:
{
"tags": ["Supplier", "testA", ....]
}
If that is the case, you can use the Item Lists node. Check the example below.
Example workflow
Hi @RicardoE105 ,
almost it, it you see in my code, then you will notice that I need to insert a increment in the result:
"value": ${t.tag}
An index? I ran you code a got:
To do that, add the following code to Map2
const tags = items[0].json.tags;
return [
{
json: {
tags: tags.map(tag => `value: ${tag.tag}`)
}
}
]
@RicardoE105 , your solution worked very well. Thank you.
If you allow me, let me ask you one more thing, how many ways is possible to select a Node, for instance:
items[0].json.tags // select from the current node
$node["Function"].json["tags"] // select from a specific node
items[0].json.app_key
$item(0).$node["Init Data"].data["myNumber"];
$items("Webhook_Start", 0, 0)[0].json.body
$items("HTTP Request", 0, counter)
$node["getPOSTCODE_API_A"].json["status"]