Auto Flow varaibale with quotation marks and commas

Hi
I am trying to create an auto flow variable for another set of nodes. I have attached the parts that I am concerned with. If I have a table
image

and I want to create flow variable like ‘A’,‘B’,‘C’,‘D’ What is the best way to proceed?

In this example the table contains 4 Rows of string. How do go about If the next time the table contains only 2 rows or the 10 Rows of string. How do I fool proof this automation?

Regards
Pio

how_flow_varaible_auto.knwf (7.9 KB)

hi @pio,

I would solve this by using a Java Snippet. That’s how you keep it simple.
First of all however, you should initialize a workflow variable - in my example it’s called “var” and you can define it by right clicking the workflow name in the explorer…
grafik

Here’s the workflow…
how_flow_varaible_auto.knwf (8.7 KB)

Hope, this helps, Greetz, Tommy

2 Likes

Hi there @pio,

why do you want to build such flow variables? Can you share what is the use case behind this?

Additionally you can use String Manipulation to add single quotes around in string column. Then group whole table with GroupBy node and use concatenate method to have values separated by comma. Finally use Table Row to Variable. Should work regardless of row count.

Here is workflow to check it
how_flow_varaible_auto_ipazin.knwf (21.8 KB)

Br,
Ivan

3 Likes

Hi @ Tommy,
Very nice the solution using the Java snippet. Thanks for the help

Hi @ ipazin
Thanks for your help. It is also a nice solution.
I get a csv file sent to me everyday which shows the parts that have issues but I have to filter part of it. I have to rename it and had manually input a local flow variable as show in the screen shot which I then run using a sql.

I was looking to automate from the csv file. So instead of manually inputting the flow variable to the sql query, how can I from the csv file automate it. Your help as well as @Tommy flow helped me solve this. I have provided you the screen shot of the workflow. As it is related to my work I wans’t sure If could post the workflow as it. I hope that this answers your question.

1 Like

Hi there @pio,

glad you made it. But if I got you right you should take a look at Parameterized DB Query Reader node. Maybe it is the node to use for your use case :wink:

Br,
Ivan

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