Table convert into flow variables and respective values

Hi guys!

I have a challange for you! I’ve a table with 2 columns for “flow variable” and “values”.

How can I use the first column to create all variables that I need and then, pickup at the same row the column value and set into corresponding flow variable?

image

As you can see above, Column “Variables” will be co create each one as flow variable. Then I will use the “Values” column to set into respective flow variable as value.

cfg_folder_base => “knime.workflow”
cfg_folder_files => "\Internos\Arquivos"

Some trick for it?

Thanks,

Denis

Hi @denisfi

I’d add a column that explicitly holds the type (str) which is required later.

image

Then convert them to lists.

image

After converting it to a variable, populate the Variable Creator node.

This will generate all the required variables.

1 Like

Thanks for reply @ArjenEX , but I maybe not be to clear about it… sorry!

I need to create flows variables using the “Variables” values as example: “cfg_folder_base” (flow variable). I could use table column to variables and resolve part of it.

After that, I need to set value for each flow variable looking the column “Values” to make the for “from => to” information.

At the end, my expected result will be:

I’ll have more than 20 flow variables and each one will have respective values from the same row looking the value column,

“cfg_folder_base” => “knime.workflow”
“cfg_folder_files” => "\Internos\Arquivos"
“cfg_folder_json” => "\Internos\Arquivos\Json"

Could I be more clear now?

Thanks for your help!

Denis

No, I don’t see anything different in your description and I don’t see why the example I posted is not fulfilling that.

Do you perhaps mean that those variables are already existing and that you want to replace/override their value?

Yeap, the flow variable will be the value from column “Variables”, and for the value will be the column “Value”.

I’ll try to change the variables views to make me clear.

From this table:

I’d like to create and set as it:

The value is wrong, but to you see the idea.

Thanks again,

Denis

From your main data stream, create a new branch for the flow variables and convert them to a table format with Variable to Table Row and Unpivot.

Then add a joiner to retrieve the override values based on the column name.

The rest of the actions can remain the same and the new variables values are ready for use.

HI, a found a solution for it… First I use row ID to use the values from variables to make the rowIDs.

After that, I use the table column to variables to set the values.

image

image

image

image

I’ll backup this for future use!

3 Likes

Replacing the Row ID before Column to Variable is a great trick @denisfi! I am definitely going to be using this one.

Sure… I’m making a config file for my flows where I can set names for flows variables and values for them… It can use it for any flows from a csv file, converting into flow variables and use into all process anytime. Other example is from a table creator, transform into json file first and then, you can put it into a container for the flow callers.

Thaks for your reply @iCFO !

2 Likes

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