Problem with Loop

I’m doing a big flow using Python processing sap script and when I need repair something it’s necessary restart the flow. Is there another way to do it without restart the flow? Thera are variables in table Creator that I use in the flow.
image

Hello Aldemir,

Do you need the variables to flow one at a time ? [as you are using python node within loop]

or

Is it okay to create multiple variables at once and then feed to other nodes ?

See the image. I run the flow using the variable that I put in the beginning. When I repair, for example, the third component that contain node python, ! have to restart all flow.

I didn’t understand how to create multiple variables. I put all variables that I need in table table creator.

Thanks for replying Aldemir,

You can use “Variable Expressions” node to create multiple variables in one node.
However you need to manually input each of them.
or
You can use “Table Column to Variable” node with “Table Creator” node that you are using.

Please refer

Note: As far as I know; if a node is between the loop start and loop end, the loop start needs to be reset when there is a change in that node to run. Hope anyone can confirm this.

1 Like

Note: As far as I know; if a node is between the loop start and loop end, the loop start needs to be reset when there is a change in that node to run. Hope anyone can confirm this.

+1 to that comment; and may I just add,

  1. To run a loop, the loop end is executed rather than the loop start. And execution is done after all nodes involved are configured properly.
  2. Any alteration after execution will reset all participating nodes.
2 Likes

@Aldemir you could try and use switch nodes to choose one path or the other. But you will have to plan carefully so this will work with your loop.

I do not fully understand what you mean by repair and restart. Though this guide might give you further ideas:

https://docs.knime.com/latest/analytics_platform_flow_control_guide/#introduction

1 Like

I agree with you. I have a “guru” and he said the same. When the Loop begins, if any modify is made the flow needs to be restarted.

I don’t know how to do this. My knime’s knowlege isn’t at this level. if-switch I will get there!!

There’s also the Variable Creator node that’s been introduced - I used to use the Variable Expressions to create variables before, but now we have the Variable Creator node for this:

I enjoyed to know this node Variable Creator but I need to use Table creator with Table row to variable because I need to run many months in this Loop. Variable Creator seems something to use once time.

Hi @Aldemir , as per my quote in my post, the Variable Creator was more of an alternative to the Variable Expressions node. And you are correct, the Variable Creator is not ideal for what you want to do.

If you want to have your variables defined in a table, something like this will work for you:
image

Here’s my table containing my variables:
image
Note: This table should only have 2 columns, 1 for the variable names and 1 for the variable values.

And here’s the result at the end. They are defined as variables:
image

The trick here is to make sure that the variable names are first converted as the Row IDs of the column, to then use the Table Column to Variable node, and you can do this via the RowID node. Here’s how it should be configured:

1 Make sure that you choose “Replace RowID with selected column values…”
2 Then choose the column that contains the variable names
3 Select “Remove selected column”, so that the variable names are not converted as values

The RowID node should result in the variable names being moved as the Row IDs and the variable values being the only column left in the table, like this:
image

I forgot to say that I need to run 12 months. In this test I put 2 months. Can This solution be applied in this case?

@Aldemir you could artificially create all the date variables of a current year. Something along this idea using a count loop construct.

1 Like

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