Operations on multiple columns with a pattern

Hello,

I have a workflow/automation abstraction problem I was not able to easily resolve.
In one table I have several columns that specify multiple measures of different objects, and the name of the column has a specific pattern (for example what you get from a GroupBy node) eg.:

  • Pears_Price
  • Pears_Qty
  • Pears_…
  • Apples_Price
  • Apples_Qty
  • Apples_.
  • Bananas_Price
  • Bananas_Qty
  • Bananas_…

Is there a quick way of making multiple calculation columns using a pattern (REGEX?)?
I would like to exploit patterns in the column names to select subset of related columns and then apply them various formulas.

In the example above I would like to make multiple columns at one like this:

(name)_Value=(name)_Qty * (name)_Price

I ended creating a table building all the formulas via string manipulation and then applying them but it was quite long (I had many calculations to do).

Thanks for the suggestions!

L.

Hello @zioludo
Once you get your columns in the loop, you just have to replace the column names by generic names aiming to feed the ‘Math Formula’ node.

‘Column Rename (Regex)’ node >> Search String (regexp) :

(^.+$)

BR

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.