The problem is that I have to rename the column to fit to the naming conventions ANDI do not know which column gets lagged since this is controlled by a Column Selection Configuration node.
If there would be a rename config within the Lag Column I could use this (=> Feature Request)
If there was any way to rename a column by position, I could do the renaming directly after producing the lag since the lag column is always appended to the right of the table - Is there a way to rename by position?
Not sure about how useful would this be. If Lag parameter is higher than one then you have same need to rename columns after it.
This approach makes more sense in my opinion and you can do it by using Column Expressions node with following syntax: column(numberOfColumns() - 1)
Check replace column and control new column name with flow variable. Should work.
Additionally use String Manipulation (Variable) node to add â(-1)â to lagged column name to create new flow variable name column name you wish to rename.
Jip, this would only work for one column. But would be enough for 99.5% of use cases - and I could propably do a 5 times loop if I want 5 loops and could still rename the columns however I want. E.g. adding â(-1)â as suffix is never an option anyways.
check workflow attached. There youâll find what I have meant with adding â(-1)â in upper flow and in next flow you can see how to solve this with renaming column which is to be lagged prior to lagging. Hope one of these solutions will work for you.
The secondflow really looks nice - very straight forward and less convoluted than my workaround.
So, we now have three ways to solve this:
Use âExtract Table Specâ and âTable Row to Variableâ to get the name of the last column to set up old_column_name and new_column_name as flow variable config
Use the information (a string) from âColumn Selection Configurationâ to manipulate the name of the original column such that it matches the new lag column name
Use the information from âColumn Selection Configurationâ to first rename the selected column to something we know and later on after doing the lag rename