Hey everyone,
I’m currently building a node with multiple functions (currently around 100).
I ran across a problems that I don’t know how to solve:
Many of my functions require data inputs as Arrays.
Those arrays can be:
- regular string arrays
- json arrays with a known structure. E.g.:
{
"name": string,
"age": number
}
- json arrays with a unknown structure
What is the best my to solve all 3 cases?
In case of string arrays i went with the following code:
{
displayName: 'My field label',
description: 'My field description.',
name: 'myFieldName',
required: false,
type: 'string',
default: [],
typeOptions: {
multipleValues: true,
},
displayOptions: {
....
},
},
But with that its not possible to pass a full array via an expression for this field. Only each individual string can be an expression. See the following screenshot.
In case 2 (json array with known structure) I went with a field of type “fixedCollection”. That ends in the same problem as for the string array where i can’t pass a full array for the field.
In case 3 (json array of unknown structure) I want with a field of type “json”. If i now set:
{
...
typeOptions: {
multipleValues:true
}
}
I would end up with the same problem that I have for case 1 and 2.
So the question:
Is it possible to pass a expression as a value for the whole array field and on the other hand make it also possible allow expressions for individual spots in the array?
I hope someone can help.
Johannes
Information on your n8n setup
- n8n version: latest
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app): locally n8n start
- Operating system: Mac OS