Identify if a column or flow variable is present; If not create one

Is there any way to figure out whether a column is present or not?

Also, is there any method present to identify the presence of a flow variable?

Thanks,
Shiva

Hi,

Checking for a column:
You can use the Table Validator (Reference) node to check for the existence of column(s) and create the column if it doesn’t exist. Use the Table Creator node to create a table with the desired column names and types, then connect it to the second inport of the Table Validator (Reference) node. The table from your workflow connects to the top inport. Then configure the Table Validator (Reference) node to create the column if it doesn’t exist.

image

Please see attached example:
check for col and create if absent.knwf (8.6 KB)

(Note: If you know Java you can use a Java Snippet node to tackle the variable part of the question, but it’s not easy to do it in a dynamic way).

2 Likes

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