Icon

Change strings in a multi-line code by position of replacement - KNIME Forum (82439)

<p>Change strings in a multi-line code by position of replacement - KNIME Forum (82439)</p>

Change strings in a multi-line code by position of replacement - KNIME Forum (82439)

https://forum.knime.com/t/changing-multiple-lines-in-a-single-cell-using-dictionary-not-working/82439/2?u=mlauber71

Dictionaryrules for replacement of code
Table Creator
Loop 3START
Chunk Loop Start
data.table
Table Reader
"Counter"
Counter Generation
Loop 3END
Loop End
Sorter
Counter Generation
Sorter
Column Renamer
RowID_1
RowID
Sorter
Sorter
Exclude Rowsthat have been changed
Reference Row Filter
Append Rowsthat have been changed
Concatenate
A_New
Column Renamer
Loop 1END
Loop End
combine rows backinto one stringseparated ny\n line breaks
GroupBy
contains($["A_SplitResultList"], $$["Code to change"])matches_code
Expression
Loop 2END
Loop End
split the code into single lines
Cell Splitter
matches_code=True
Row Filter
bring old andnew back togetherto compare
Joiner
only the first linewill be used, that is OK
Table Row to Variable
Loop 2START=> make sure your replacement code is sorted!
Group Loop Start
Loop 1START(one code block per row)
Chunk Loop Start
String Replacer (Dictionary)
"Counter"
Counter Generation
match line of codeand replacement by positionfirst occurrence -> first replacementMatch by "Counter"
Joiner
A_SplitResultListget the code inindividual Rows
Ungroup

Nodes

Extensions

Links