Problem with Moving Average Node inside loop

Hi all,

I have a workflow with a loop, and inside that loop, I get a table with some different columns each time. In order to create some graphs, I have a wrapped node with a Moving Average Node. That table has one date column with continuous date values for each day (always with the same name) and several integer columns, with different columns names in each iteration. Moving average Node doesn’t have a regex o wildcard filter, and it generates an error and stops my workflow when a column name change. When it happens, I only have to open configuration of Moving Average node, and press “Apply” button, without any change, and the error disappears, and the loop can continue, until next name change.

Any idea?

Hi,

To ensure static column names entering into the “Moving Average” node, insert “Column Rename (Regex)” node, it will always outputs same column names like col_1, col_2, etc. Then (if needed) you might change the names back to original ones at specific point of your workflow using “Column Rename” node.

Martin K.

obr%C3%A1zok

1 Like

Thanks. Your tip was great and it solved my problem when the table has the same number of columns. But when the number of columns is different, I still have problems. Moving Average Node is always looking for the same number of columns, and it is always the number of columns in the table during the first iteration of the loop.

Well, finally I solved the problem replacing Moving Average by Moving Aggregation Node. This node allow you to automatically select the columns to include (by type or pattern) in the aggregation, what is something that you have to do manually in Moving average (and obv cannot be changed inside a loop).

1 Like

Hi jricgar,

Thanks for info, I enjoy you have succeeded :slight_smile: .
Regards !

Martin K.

Hi,

I am facing the same issue with the Moving Average node. Inside a loop with variable number of columns it won’t work. As mentioned, Moving Aggregation node does work, but it doesn’t have the same number of options such as exponential moving average. I’d be grateful if the Moving Average node could be aligned with Moving Aggregation, or alternatively more options added to Moving Aggregation.

Hello there @pzkor,

you can use following workaround to have Moving Average working in a loop. Before Moving Average use Column Filter Widget node which creates flow variable with included column names and which you can then use in Moving Average node to control included columns. To always include all columns exclusion list should be empty and Enforce exclusion option checked. Take a look at similar example with Joiner node:

Additionally ticket is created to improve configuration dialog of Moving Average. (Internal reference: AP-16356)

Br,
Ivan

2 Likes

Thanks very much for the neat fix!

1 Like