Describe the problem/error/question
Hello everyone,
i have a postgresql node returning this kind of items :
[
{
"id_service": 100001,
"nom_colonne": "field_1120",
"valeur_attendue": "1"
},
{
"id_service": 100002,
"nom_colonne": "field_1121",
"valeur_attendue": "0"
},
]
I want to get all this array in a unique item named “listeServices” containing all this array.
To do so, i tried a Set node with a value “listeServices” and this expression :
{{ $items("Postgres Rechercher tous les id de services1") }}
The output is an array item named “listeServices” but its content is objects with “json” and “pairedItem” attributes, for example :
[
{
"listeServices":[
{
"json":{
"id_service":100001,
"nom_colonne":"field_1120",
"valeur_attendue":"1",
"id_operation":null
},
"pairedItem":{
"item":0
}
}],
}
];
Thank you for your help.
Please share your workflow
Information on your n8n setup
- n8n version: 0.230.2
- Database (default: SQLite): postgresql
- n8n EXECUTIONS_PROCESS setting (default: own, main): main
- Running n8n via (Docker, npm, n8n cloud, desktop app): docker k8s
- Operating system: linux
Hi @Alban_TUAL
Is this what you’re looking for?
Hello, thank you for your answer, yes this is exactly what i’m looking for but when i get the value of listeServices i get this :
[
{
"listeServices":[
{
"json":{
"id_service":100001,
"nom_colonne":"field_1120",
"valeur_attendue":"1",
"id_operation":null
},
"pairedItem":{
"item":0
}
}],
}
];
how can i get it has you did ?
Regards
I don’t understand. What exactly you’re getting from the Postgres node?
The direct output of the postgrest node is like this :
[
{
“id_service”: 100001,
“nom_colonne”: “field_1120”,
“valeur_attendue”: “1”,
“id_operation”:null
},
{
“id_service”: 100002,
“nom_colonne”: “field_1121”,
“valeur_attendue”: “0”,
“id_operation”:null
},
]
But then when I try to recover this output in a Set node not directly connected to the previous postgrest node I get this kind of result :
[
{
“listeServices”:[
{
“json”:{
“id_service”:100001,
“nom_colonne”:“field_1120”,
“valeur_attendue”:“1”,
“id_operation”:null
},
“pairedItem”:{
“item”:0
}
}],
}
];
Hi folks, the example provided by @mcnaveen above would return the full n8n data structure in the listeServices field, but it sounds like that’s not what you’re after @Alban_TUAL.
Perhaps you want to use the Item Lists node instead? This node has a “Concatenate Items” operation which would return only the “visible” parts instead:
Here’s an example workflow: