Hi @christoph_knime , welcome to the KNIME community
If you are happy to write some code, the Column Expressions node (in the KNIME Expressions extension) can derive this by cumulatively calculating the “tree”.
var treeOutput // variable for cumulative tree calculation
// define the column representing the current Level
currentLevel=column("Level (Input)")
/* define some support functions */
function getTreeToLevel(tree,level)
{
if (tree==null || tree=="")
{
return "0"
}
/* evaluate the current tree up to the Nth period */
n=level
l=length(tree)
outTree=""
for(var i=0;i<l && n>0 ;i++)
{
c=tree[i]
if (c=="." ){n--;}
if (n>0) outTree=outTree+ tree[i]
}
if (n>1)
{
// add a new level as .0 (this will be incremented by caller)
outTree=outTree+".0"
}
return string(outTree) // make sure the output is a string or problems can occur
}
function getTreeLevelCount(tree)
{
return toInt(countChars(tree,".")+1)
}
function incrementTree(tree)
{
currentLevel= getTreeLevelCount(tree)
lastNumber = substr(tree,lastIndexOfChar(tree,'.')+1 )
parentLevel=currentLevel - 1
if (parentLevel==0)
{
return toInt(toInt(tree)+1)
}
lastNumber ++
return getTreeToLevel(tree,parentLevel)+"."+toInt(lastNumber)
}
// special case for initial "unknown" tree
if (treeOutput == null)
{
treeOutput="1"
}
else
{
x=getTreeToLevel(treeOutput, currentLevel)
treeOutput=string(incrementTree(x))
}
treeOutput // explicitly output the current value of variable
I’ve uploaded a demo workflow using your sample data here: