Node to type multiline string into

I have a MN that takes connection and sql string inputs, and outputs the results data of the query. This is for a scheduled report.
What node can i use to enter the string sql into that is multiline?
Preferably syntax highlighted. :slight_smile:

Hi @SLL1966

Welcome to the forum! :slight_smile:

I guess the DB SQL Executor node does the job for you. There you can paste your multiline SQL statement and it gets syntax highlighted. If needed you can also inject the SQL statement using a flow variable.

Does this help? If not I’d need a bit more information to better understand what you intend to do.

Best wishes,
Alice

Thanks Alice.
Unfortunately i can’t have any DB nodes outside of my reusable and secure Component which has the credentials, connector, execute, and close.
(I need to pass my completed SQL string into it)
I have used DB Query Reader to type multiline SQL into, including the use of flow variables. That node config is pretty good also.
What i need is a multiline string node that does not require server/portal usage. Currently users are also going to use the dev side of KNIME not the server portal (not their or my choice)

@SLL1966
Is it maybe the Line Reader node?
Sorry, I have my wires crossed. Do I understand correctly that you are looking for a node that allows users to enter their multiline SQL statement (ideally with syntax highlighting), not to be executed in the webportal (i.e. no widget node), and the SQL statement is then passed into the secure component and executed there?

Yes, exactly. Even for us developers, we want a nice place to define a multiline string that we can pass to a component.

Hi @SLL1966

Ah thanks, got it finally!
The String Widget node has a config option “Editor type: Multi-line”. However it lacks syntax highlighting, and you would need to add a white space at the end of lines. I think this is the closest you can get with KNIME-native nodes, sorry!

In case you are really good with JS, you can try to set up a text editor in the Generic JavaScript View node, or somehow make use of the DB Query Extractor node that acts on an empty dummy database outside the component, but yeah, that’s far from ideal and straightforward.

Hope that still helped!
Best, Alice

1 Like

Right,
The String Widget only works for multiline when deployed to the server web portal, AND the SQL isn’t something i want randomly typed there.
It seems really weird that KNIME doesn’t have a way to define a string value using a multiline editor that will output it as a variable.

Hi @SLL1966 , while waiting for better solutions, one thing you can try is to write the code on a .txt file, save the file on a folder dedicated for this sole purpose, and upload it to your Knime workflow through the Tika Parser.

You might want to delete the commentary lines in the script prior to uploading, unless you’re willing to clean it up with complicated regex afterwards. The output will be of a String type as shown in the image above.

2 Likes

Thanks, I added/noted your request (internal reference AP-6601).

2 Likes

Thank you. For now i will edit in external SQL editor, test, then paste into the one line string config with any imbedded flow variables from upstream.