Hello,
I would like to dynamically combine strings from multiple items into a new string that I can then process.
Specifically, I have the following example:
I read a database and get the following items: Each of these items contains the element Text, Type and ID.
I want that every time an item has the Type:Headline the text of this item together with the texts of the following items are combined into a new string until the next item with the Type: Headline.
For example, in the attached example, the texts of the items with IDs 3-10 should be combined into a single text string. The next blocks would then be IDs 11-13 and 14-17.
I have already tried a few things but I just can’t find a suitable solution how to achieve this. Maybe someone here can help me or give me a tip on how to implement this.
Thanks a lot
[
{
"id":1,
"order":"1.00000000000000000000",
"Text":"Component elements",
"Type":"Headline"
},
{
"id":2,
"order":"2.00000000000000000000",
"Text":"Ceramic capacitors",
"Type":"Headline"
},
{
"id":3,
"order":"3.00000000000000000000",
"Text":"Rule 5",
"Type":"Headline"
},
{
"id":4,
"order":"4.00000000000000000000",
"Text":"When using ceramic chip capacitors .... Suggestions:",
"Type":""
},
{
"id":5,
"order":"5.00000000000000000000",
"Text":"Use of series ...",
"Type":""
},
{
"id":6,
"order":"6.00000000000000000000",
"Text":"Use of ceramic capacitors ....",
"Type":""
},
{
"id":7,
"order":"9.00000000000000000000",
"Text":"Use of ceramic capacitors with ....",
"Type":""
},
{
"id":8,
"order":"10.00000000000000000000",
"Text":"Use of ceramic capacitors with integrated ...",
"Type":""
},
{
"id":9,
"order":"12.00000000000000000000",
"Text":"Two series-connected ceramic capacitors arranged ...",
"Type":""
},
{
"id":10,
"order":"13.00000000000000000000",
"Text":"Use of wired ceramic capacitors",
"Type":""
},
{
"id":11,
"order":"14.00000000000000000000",
"Text":"Rule 7",
"Type":"Headline"
},
{
"id":12,
"order":"15.00000000000000000000",
"Text":"Voltage strength:",
"Type":""
},
{
"id":13,
"order":"16.00000000000000000000",
"Text":"For 12 V applications, types with a voltage strength of ....",
"Type":""
},
{
"id":14,
"order":"18.00000000000000000000",
"Text":"Rule 8",
"Type":"Headline"
},
{
"id":15,
"order":"19.00000000000000000000",
"Text":"Type:",
"Type":""
},
{
"id":16,
"order":"20.00000000000000000000",
"Text":"Capacitors with a capacity/package at ....",
"Type":""
},
{
"id":17,
"order":"21.00000000000000000000",
"Text":"The use of the 1206 package shall ....",
"Type":""
}
]
Information on n8n setup
- n8n Version 0.209.2
- default: SQLite
- Running n8n via Docker