here are two more ways. Only scripting (I see you wrote you are looking for a solution without scripting but then used both Java and Column Expressions in you workflow) using Column Expressions and one outputting RowIndex when change detected in Rule Engine together with Missing Values to have same id in every group followed by Rank to complete it.
Yes, I made a mixed solution with Java snippet and column expression, I am new in KNIME and do not know everything, but tried to solve the problem meanwhile, that was the result workflow.