Hi @TigerCole,
Doing this with regular nodes turned into something of a marathon, so I’m hoping somebody else can maybe take this and find some shortcuts, or alternative nodes that I haven’t thought of.
Anyway, attached is a workflow that achieves what you have requested. It assumes that the data is correct/consistent (for example that you don’t have a space in “MAIN :”, which you had in your sample data)
The attached workflow actually has two alternatives. Some people here won’t be surprised to see me include a java snippet (low-code) version, since this task involves deriving information sequentially from a previous row and a regular nodes (no-code) version. I’ve tried to keep the java itself down to the absolute minimum as I think that where possible, non-script nodes are preferable, but as you can see, in this case it greatly reduces complexity (provided you can work out what the java is doing!) compared with my other attempt.
I’m hoping that the comments in the workflow adequately explain what is being done at each stage, but please ask if anything is unclear.
Prefix groups of rows with preceding text.knwf (40.1 KB)
Hoping that this works for you, but also that it will be a catalyst for somebody to find a simpler way!