How to detect and add a missing columns?

Hi all, I’m running into an issue with the Java Snippet. If I run a workflow with a POST Request or PATCH Request, the column Status is automatically created. However sometimes I do not have any rows to update, so the POST/PATCH Request don’t run. When 1 of them does not run, the Status column is not created and my Java Snippet fails, this eventually results in my entire workflow failing because I depend on a concatenation to summarize my results via email.

What’s the best way to detect and add a missing column? Here’s an example workflow…
POST and PATCH Test.knwf (16.8 KB)

Hello @hops650,

there are Table Validator nodes to ensure certain table structure. (Including adding missing columns.)

I prefer reference node but it’s up to you which you want to use :wink:

Br,
Ivan

7 Likes

To deal with a missing column there is this thread:

You could use a Java snippet to detect a missing column.

Also you might adapt this example:

4 Likes

Thanks Ivan,
maybe I missed it but is there a detailed explanation what “out of domain” actually means?
Thanks

Hello @Daniel_Weikert,

domain is the “list of possible values” for a column. If you click the “Spec” tab in an output table, you’ll see the data types of the columns and the domain of the values in the columns. For numerical values, only the range of the values in the data is shown. For string values, the different values appearing in the data are shown (by default up to 60 values but this can be changed; see here how).

This forum topic regarding domain and it’s refreshing is also useful:

Br,
Ivan

2 Likes

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