Simple KNIME Variable Input

I have a workflow that takes data from the database, then goes through many steps to package that data, send it to a Web Service, and then handle the output.

The issue is that whoever is running the workflow has to enter an ID into the SQL in the Database Reader. This works, but it’s not great - you have to scroll down to get to the right place to enter the value (and then you have all the normal SQL constraints – it’s very easy to break).

What I’d really like is a way for the user to enter an ID outside of the SQL, pass the SQL that variable, and then have the workflow go. From what I’ve learned, the best way to do this is by using a Workflow Variable.

  1. Is a Workflow Variable the best way to handle this?
  2. What kind of node should I be using?
  3. Once the workflow variable is available to use, how do I reference it inside of the SQL?

Hello @blackdrago -

You are on the right track when thinking about workflow variables. I’ve attached a simple workflow that uses a quickform to gather input from the user, and then uses that input to parameterize the SQL query.

QuickformFlowvarSQLExample.knwf (718.9 KB)

The workflow consists of a wrapped metanode. You can double click the metanode to set the parameter for the query. If you Ctrl-double click it instead, the metanode will open and you can see the nodes inside.

If you haven’t used workflow variables or quickforms before, you’ll want to check out these sections from our E-learning course:

1 Like

Hi there!

To share my way of handling different URLs, hostnames, database names, user/password inputs… I have created an external file with all necessary inputs mentioned above. When those are read in KNIME I have created out of them flow variables. With those flow variables you parametrize your nodes.

DBExtFile

This way switching from development, test or production with different users makes things a bit easier. Just point to different file :wink:

Br,
Ivan

Thank you ScottF and ipazin for your replies!

@ScottF - Are there transcripts for the videos? And/or captions?

Thank you!

Hi @blackdrago -

I don’t know if transcripts exist, but the videos are actually double captioned - once with manually edited boxes we edited in, and also the (less accurate) auto-generated Youtube captions.

Check the videos out and let us know if you have question or suggestions. :slight_smile:

@ScottF
RE: The hand-captioning… Do you mean the yellow-bordered boxes that appear sometimes? They don’t contain all the needed information… For example, at the beginning of the first video (starting at 0:15), there’s a lot of circling and such, but no caption until 0:44 (“Of course, all this could have been done with a GroupBy node only.”) So they’re helpful if you’re going back to a video you’ve watched before and need to find a specific place, but they don’t contain enough information to follow the video without sound.

I hadn’t seen the YouTube auto captions before. They do work, but the constantly moving text is a bit hard to read… I’ll play around with the settings a bit … thank you for the reply.

If you are taking suggestions, then please consider transcripts for the videos. Transcripts are easier to use, particularly when it comes to searching. I’ve watched a number of these videos, and while the hand-captioning does help when I’m trying to go back through and find a particular section, it’d be much easier to do a Ctrl+F and search via text…

Again, thanks for your reply!

1 Like

This is good feedback - I’ll pass it on to other folks on the Evangelism team. We often have scripts on hand for recording the videos, so uploading links in the Youtube comments to those documents might be something to consider.

Thanks!