variable loop and variables not available in connected node

Hi folks and a happy new year 2022!

i have build a workflow that should read verb forms from a web page and write them down to a text file that can be read by my flash card vocabulary app:

  1. read spanish verbs from a static table and submit them to a website one by one (per iteration)
  2. the website will then show a page with multiple tables (numbered in the html-code), each table representing a different verb tense (present, future, past, conditional etc.) of that verb.
  3. the second nested loop will read numbers of the required tables from a static table and extract the related table from the page. In each iteration of this loop, the information extracted is written into a text file (create/append) for that specific tense.
  4. once all tables/verb tenses are written for a verb, go back to → back to 1), the next verb from the list is fed to the page …

the result is one text file for each tense, containing all conjugations (rows from each web table) concatenated in one row per verb, like this:

the whole process already worked once for the first iteration (5 files - 1 for each tense - correctly written by the csv-writer), before adding the loop ends. Then I wanted to close the loops and the problem started:

  1. I understand that something is misconfigured with the variable loop ends (each loop end refers to the respective variable), but I don’t know what.
  2. I got the “Can’t merge flow variable stacks” message thrown by the table extractor node, but
  3. I cannot reset that node and I cannot configure it: the variable “html_path” created in node 11 (that points to the table to be extracted) will not show up for selection in the flow variable section of the table extractor.

I tried to reset all nodes, reload the whole thing, even throwing away the table extractor and configuring a new one did not help. Any suggestions? Thanks!

@roberting from the screenshot it does look like the start of both the loops is on the same level so it would not know which on is the outer and which one the inner loop You will have to correct the wiring.

Sometimes it does help to put the contents of a loop inside a Metanode or Component so that it will be obvious which operations would belong to which loop.

5 Likes

Hi @roberting , I agree with @mlauber71 . Though you said you have a nested loop, it’s not clear which loop is inside which loop. They look like they’re on the same level as @mlauber71 pointed out.

2 Likes

Hi @bruno29a , @mlauber71 ,

Thanks for pointing his out; the automatic layout placed the starting points visually on the same „level“ (leftmost).
However, my understanding was, that the „data path“ is somehow the principal path, while the „variable path(s)“ are of a „lower“ priority.
Thus I assumed the data path would first start the verb loop start (called from node 37, the clear node) and later, once arrived at the table extractor node, call the „side branch“ (the „variable path“ with the verb tenses loop start).
As i understand now, that is obviously not the case.
But it leaves me puzzled as how to set this up at all, that is, how to define the „main execution chain“ that determines the execution order ?! :thinking:

You will have to tell them what the order is by connecting the nodes typically with flow variables. What will happen is that you have a cross-country join of your variables/paths and you will have to make a decision what should happen (BTW that would be the case in any programming language or system).

Might I suggest you check out the KNIME guide about loops and so on:

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

If you can provide us with a working example of your workflow we might be able to take a look.

Here is an example of three loops nested. But again: you will have to think about what it is you want to do and how to handle the result at each step.

3 Likes

Thanks @mlauber71 for the links and the explanation - I guess it‘s back to school for me now :pensive:

Hi,

bruno and mlauber have already explained in detail what’s wrong. Not gonna repeat that, here’s a visual shortcut:

Happy New Year, T

3 Likes

cheers @Thyme !
that was embarrassingly simple :sweat_smile:

4 Likes

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