DB Insert using included_names parameters

I created a workflow that would read excel files with different template columns (assume 3 different templates). Is it possible to use one DB insert node only and use included_names in the flow variable tab? I tried to pass the needed columns but didn’t succeed as the node is still looking in the included box.

Appreciate your kind help. Thank you.

Flatfile Main.knwf (83.2 KB)

Hi @csarsonas , are you able to upload the excel files (or dummy ones of the right format), as they are located outside of the workflow’s data folder and so haven’t been included with the workflow. thanks.


I’ve managed to put in a dummy Excel sheet just so I can see the config of the nodes… so this may give you what you need

For the “included columns” to use your flow variable, it needs to be a String array. I see you tried to do this in the java snippet, but you’ve actually created a string that just looks like a string array but is actually a comma delimited string with square brackets at the ends.

Unfortunately java snippets cannot in themselves create string array flow variables, so you need to get the java snippet to create a string array column, and then convert this afterwards to a flow variable.

You will need to recreate this java snippet


so that it creates a column called included_columns like this:

if (columnExists("policy_number"))
	out_switch = "top";
	out_switch = "bottom";

out_included_columns = new String[] {"commodity","classification","congress",

Note when you initially specify the column, you will need to tick “Is array”

but when you do that, the snippet defaults (certainly every time I’ve ever done it!) to “Array of Reader”

You’ll need to double click Array of Reader on the lower panel and then you can change it to “Array of String”

So your java snippet will look like this (ignore the column names in my left-hand panels, as I’ve just mocked this up):

After that you will need to turn your “included_columns” column into a flow variable, and remove it again from the data set


and on your existing column filter

you will need to set the included_names to the included_columns variable which you can now see is a String array as it has the S[] icon

The other thing I noticed in your flow was that you hadn’t completed your IF Switch. That may be because it was still work in progress, but there should really be an End IF node attached. For example see picture below but it might be your want to bypass other nodes too, so connect it to whichever is node appropriate


I’m also now thinking that there isn’t an End IF for the first IF Switch either, so I would have expected that you would have an End IF just prior to (perhaps) the DB Insert, or certainly before the Variable Loop End but I cannot tell for sure without being able to open the flow (with valid excel files)

e.g. instead of this:

Should it perhaps, be something like this (and you’d maybe need to set the table name in both DB inserts with a flow variable)…

or if it could be you only want to “End IF” at the variable loop end, in which case I think you could maybe use Flow Variable End IF, as you aren’t carrying data flow through


hope that helps!


@takbb the passing of parameters to include_names was one of my difficulties as i thought the comma-delimited string would be enough. Yes the workflow is still a work in progress as i need to resolve also using one DB insert node only after the process went part-ways/split as it was under a loop node.

Thank you very much for you kind help and effort

1 Like

Hello @csarsonas

Should be possible. See here how I used Column Filter Widget node to have column names in list flow variable:


1 Like

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