# DB Row Filter using dynamic flow variables

**URL:** <https://forum.knime.com/t/db-row-filter-using-dynamic-flow-variables/67435>\
**Category:** KNIME Analytics Platform\
**Created:** [May 24, 2023, 5:40pm UTC](https://forum.knime.com/t/db-row-filter-using-dynamic-flow-variables/67435 "2023-05-24T17:40:18Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![waddoum81](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/w/977dab/32.png) [@waddoum81](https://forum.knime.com/u/waddoum81)\
**Post date:** [May 24, 2023, 5:40pm UTC](https://forum.knime.com/t/db-row-filter-using-dynamic-flow-variables/67435/1 "2023-05-24T17:40:18Z")

</div>

Hello,  
Apologies if this has been answered before, I exhausted all options before posting this. I’m new to Knime but have a lot of Python and SQL experience… so my struggle is just finding the right nodes and understanding the architecture of passing variables/parameters.

I have a snowflake reader and trying to do a dynamic row filter based on a list of values in an excel file. I saw another post where Table Row to Variable Loop Start was used however i’m still not able to make it work… my questions are:  
1- excel row to flow variable: each value has its own variable name, I’m not able to find where to give this a single variable name that i can pass to the DB row filter as one variable list?  
2- how does this loop work? pass first variable to row filter then second, third… and finally all results are aggregated automatically?  
3- Is it possible to do the same with the Table Column to Variable? is there an additional loop node that I can add?

Note: excel files have values that I want to use to filter the snowflake data, since it might change - I’m trying this variables approach to keep it dynamic.

Thanks a lot for any support.  
 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/3/4/3413379991081b921a492fc601b3100ffd2e37a1.png)

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/c/0/c0c69220b34c6f7b2dd44b1d693236f37817ec46.png)  
 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/8/c/8cb3ec62e0b1feb8f412f493d5ecf02a55e9040a.png)  
 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/f/8/f8e5ab9df784b25bf128f0ae3bec9c9e2aa15e36.png)  
\< images are from the row to variable loop start and db row filter\>

BR/Wissam

---

<div class="post-metadata">

**Author:** ![denisfi](https://forum-cdn.knime.com/user_avatar/forum.knime.com/denisfi/32/83308_2.png) [@denisfi](https://forum.knime.com/u/denisfi)\
**Post date:** [May 24, 2023, 6:10pm UTC](https://forum.knime.com/t/db-row-filter-using-dynamic-flow-variables/67435/2 "2023-05-24T18:10:10Z")

</div>

Hi @waddoum81 ,

If you have a list with terms as a unique column, why don’t you use the joiner node to match?

You can use it to find if you have a single value and pass only rows that you want. What do you say about this?

If you can put here a dummy example, can be easier for us to see and understand about your problem.

Thanks,

Denis

---

<div class="post-metadata">

**Author:** ![waddoum81](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/w/977dab/32.png) [@waddoum81](https://forum.knime.com/u/waddoum81)\
**Post date:** [May 24, 2023, 6:27pm UTC](https://forum.knime.com/t/db-row-filter-using-dynamic-flow-variables/67435/3 "2023-05-24T18:27:14Z")

</div>

Hey @denisfi, thanks a lot for your comment… i actually first started with the joiner cos that made more sense me (left, right joining) but knime gave me error cos i was trying to join a db table with an excel table… any thoughts there?

---

<div class="post-metadata">

**Author:** ![denisfi](https://forum-cdn.knime.com/user_avatar/forum.knime.com/denisfi/32/83308_2.png) [@denisfi](https://forum.knime.com/u/denisfi)\
**Post date:** [May 24, 2023, 6:48pm UTC](https://forum.knime.com/t/db-row-filter-using-dynamic-flow-variables/67435/4 "2023-05-24T18:48:10Z")

</div>

if you’ll make a routine with it, why don’t you put the excel result into a database table first and then, you can use the join inside the database to make it quickly?

BR, Denis

---

<div class="post-metadata">

**Author:** ![waddoum81](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/w/977dab/32.png) [@waddoum81](https://forum.knime.com/u/waddoum81)\
**Post date:** [May 24, 2023, 6:51pm UTC](https://forum.knime.com/t/db-row-filter-using-dynamic-flow-variables/67435/5 "2023-05-24T18:51:45Z")

</div>

Unfortunately i only have read access to the DB… trying to automate a report, that’s why i took down this route.

---

<div class="post-metadata">

**Author:** ![waddoum81](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/w/977dab/32.png) [@waddoum81](https://forum.knime.com/u/waddoum81)\
**Post date:** [May 24, 2023, 6:52pm UTC](https://forum.knime.com/t/db-row-filter-using-dynamic-flow-variables/67435/6 "2023-05-24T18:52:52Z")

</div>

I’m trying now to convert the excel table to a DB Table using the create DB table node… and then we’ll attempt joining that with the snowflake db table… hopefully it will work, any other thoughts?

---

<div class="post-metadata">

**Author:** ![denisfi](https://forum-cdn.knime.com/user_avatar/forum.knime.com/denisfi/32/83308_2.png) [@denisfi](https://forum.knime.com/u/denisfi)\
**Post date:** [May 24, 2023, 7:34pm UTC](https://forum.knime.com/t/db-row-filter-using-dynamic-flow-variables/67435/7 "2023-05-24T19:34:26Z")

</div>

Well, you can make your selection from DB and after the DB Reader to inside the knime path/flow, you can use the join to match, but you won’t work inside the database. After the join, you can set a insert/update info if necessary.

---

<div class="post-metadata">

**Author:** ![waddoum81](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/w/977dab/32.png) [@waddoum81](https://forum.knime.com/u/waddoum81)\
**Post date:** [May 24, 2023, 8:20pm UTC](https://forum.knime.com/t/db-row-filter-using-dynamic-flow-variables/67435/8 "2023-05-24T20:20:55Z")

</div>

that’s exactly what i’m trying now but unfortunately started getting a new error “Execute failed: Cannot perform CREATE TEMPTABLE. This session does not have a current database. Call ‘USE DATABASE’, or use a qualified name.”  
And knime doesn’t allow me to connect the DB table creator to the DB joiner… i made the table as temp in memory only… any suggestions?  
 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/a/2/a2d7e65a9abec041eca896cbdfa986123c983074.png)

---

<div class="post-metadata">

**Author:** ![waddoum81](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/w/977dab/32.png) [@waddoum81](https://forum.knime.com/u/waddoum81)\
**Post date:** [May 24, 2023, 8:28pm UTC](https://forum.knime.com/t/db-row-filter-using-dynamic-flow-variables/67435/9 "2023-05-24T20:28:52Z")

</div>

Finally, got it to work… found another node that allows joining with excel tables  
 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/7/6/765e403f102b4541d9933eb74f29c647d918d563.png)  
Thanks a lot for the support!!

---

<div class="post-metadata">

**Author:** ![denisfi](https://forum-cdn.knime.com/user_avatar/forum.knime.com/denisfi/32/83308_2.png) [@denisfi](https://forum.knime.com/u/denisfi)\
**Post date:** [May 24, 2023, 8:37pm UTC](https://forum.knime.com/t/db-row-filter-using-dynamic-flow-variables/67435/10 "2023-05-24T20:37:24Z")

</div>

I mean something like this:

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/f/f/ff6a625c9d0a1d5cfc8c2069b28edb5ba133b75f.png)

[KNIME\_project\_database\_excel\_join.knwf](https://forum.knime.com/uploads/short-url/ezJT3Uu3ehfW65G0NGUgAwbW3HS.knwf) (22.9 KB)

BR,

Denis

---

<div class="post-metadata">

**Author:** ![waddoum81](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/w/977dab/32.png) [@waddoum81](https://forum.knime.com/u/waddoum81)\
**Post date:** [May 24, 2023, 8:39pm UTC](https://forum.knime.com/t/db-row-filter-using-dynamic-flow-variables/67435/11 "2023-05-24T20:39:58Z")

</div>

you know the problem i have with this solution now is that my table has millions of records… so if i dont do the row filter before i read the data… it will take forever everytime… im back to square zero, i need to find how to load my criteria in a variable list and pass it to the row filter node.

---

<div class="post-metadata">

**Author:** ![denisfi](https://forum-cdn.knime.com/user_avatar/forum.knime.com/denisfi/32/83308_2.png) [@denisfi](https://forum.knime.com/u/denisfi)\
**Post date:** [May 24, 2023, 8:59pm UTC](https://forum.knime.com/t/db-row-filter-using-dynamic-flow-variables/67435/12 "2023-05-24T20:59:04Z")

</div>

You can try this…

From excel, bring to database with DB Looping node

![image](https://forum-cdn.knime.com/uploads/default/original/3X/e/4/e4750e75551ef86c6638268e8edb4b5dc8d7c2ef.png)

Inside this node, you can set the database column list, the Column list and flow list.

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/2/5/258275b49b21d250dba791c23bfce119f0596f70.png)

With it, you can create a script to change the info from conditions to match with the flow list or column list… and as a loop node inside the database, can set a limit linke 10k of rows to make this process.

Try it and bring some news…

Thanks,

Denis

---

<div class="post-metadata">

**Author:** ![Daniel\_Weikert](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/d/e47c2d/32.png) [@Daniel\_Weikert](https://forum.knime.com/u/Daniel_Weikert)\
**Post date:** [May 25, 2023, 4:19pm UTC](https://forum.knime.com/t/db-row-filter-using-dynamic-flow-variables/67435/13 "2023-05-25T16:19:44Z")

</div>

Just to add if you like to use the values in your flow variables in your first screenshots you need to first group them and create a list of those strings so you can reference them in “values” filter variable in Row Filter node  
br

---

<div class="post-metadata">

**Author:** ![waddoum81](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/w/977dab/32.png) [@waddoum81](https://forum.knime.com/u/waddoum81)\
**Post date:** [May 25, 2023, 4:44pm UTC](https://forum.knime.com/t/db-row-filter-using-dynamic-flow-variables/67435/14 "2023-05-25T16:44:59Z")

</div>

i figured that out today… i was having a node missing at the end to make the loop work, my row filter node was taking only first node. Thanks for sharing

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/b/d/bd40b605dc2258569b9a1dd62d9f03e7ffbdb28f.png)

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [June 1, 2023, 4:45pm UTC](https://forum.knime.com/t/db-row-filter-using-dynamic-flow-variables/67435/15 "2023-06-01T16:45:52Z")

</div>

Closed on June 1, 2023, 4:45pm UTC

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