Here is a component that I put together to help with multi-line string range edits. Thanks to @armingrudd for sharing his Nominal Range Row Filter with me on a recent call which I expanded upon! I find this particularly useful for things like automating re-occurring code editing tasks, flexible report restructuring / formatting, Line Reader text editing, etc. It simplifies multi-line editing and also avoids the hassle of using a ton of escape characters when dealing with code.
Select the target Column Name on main input Table that requires editing (Multi-Line Replacement Range is always set to target the 1st Column position of (Input #2), ignoring column names)
Target the row filter range start and end points via below settings:
Criteria Match (String / Missing or Empty / Regex Pattern)
String Entry for Match Criteria (Do not leave blank in String or Regex modes, Ignored when in Empty / Missing Mode)
Select which Occurrence you want to target (1st, 2nd, 3rd, etc)
Select an offset for your range target row from the criteria match (0=no offset, -1 up a row, 1 down a row, etc)
Select if you want to Keep or Filter your Target Row from the range filter
Output Columns
Adjusted Range Filtered & Replaced Table
Original Multi-Line Row Position Count (with inserted rows showing as Missing for easy locating)
Multi-Line Text Range that was filtered from the original table for review
hi @iCFO It looks interesting, but I can’t think of too many use cases. Even if you tell me “automating re-occurring code editing tasks, flexible report restructuring / formatting, Line Reader text editing, etc.”, I still can’t relate it to reality. Can you tell me more about the actual use cases?
I downloaded your wf, and it seems to be just a function replacement scenario. What can replacement do? Under what circumstances is replacement required? I’m still a little confused.
A dynamic range find and replace is certainly going to be a niche tool. Users that utilize KNIME strictly for tabular structure based data wrangling and analysis will rarely come across a need for a component like this… I do my share of data wrangling, but I tend to view KNIME more as a universal automation multi-tool that can be applied to almost any project. It is also a basis for me to build out more advanced in-house components such as AI integrations.
Dynamic code replacement (such as in the example workflow):
The Multi-Line dynamic code snippet replacement in my example workflow is actually a small part of a wider workflow that converts a large generated website into a domain specific installable pre-cached Progressive Web App. (The wider workflow reads in a large static website / catalogs cache files & references / checks for missing references / assets / etc and then performs tasks like generating an error free cross referenced Service Worker, Webmanifest, index file, creating icon collections, adding additional functionalities / code improvements (such as in my example workflow), and finally it opens the website locally for testing.) It is used to create highly customized Point of Sale touchscreen presentations for business clients which are targeted to address opportunities that were identified in analysis of their underlying sales performance data. This workflow is portable between clients and projects, is required after every draft / version update, and the manual process is lengthy and error prone… This is all dynamically done in seconds. Pretty niche right?
Reporting -
When someone asks “I get this report from so and so and we don’t have the data to recreate it… Can we automagically include this section in your reports?”, you get to say “Sure! It will just take me a few minutes to dynamically reference in a range change and bring in pre-formatted report areas / images into your final report structure.”
If you select “Keep target row in output” for the beginning / end row targets and pinpoint the same row in each, then it functions as a “dynamic range insert tool” which allows you to dynamically drop in report segments or blank row spacing.
My report structures are pretty dynamic (so dynamic range references reduce errors), replacement report areas can be read in from other sources (such as emails or outside pdf reports), I can conditionally drop in those ranges when appropriate (such as depending on which information is more up to date), the drop in range can sometimes already be pre-formatted or might be an alternate data type which requires pre-formatting on the side.
I am particularly excited to turn this into a drop in dynamic range reference locally run AI summarizer tool! My reports formulaically identify / list revenue enhancement opportunities as well as the potential upside to addressing them. (Inserting these comments into a long report structure is another nice basic use case for the component) I particularly love the idea of being able to instantly drop in a component that takes formula generated report comment data (along with some writing examples, business use case background, summary tables, etc.) and replaces or inserts AI generated clean, well written and pre-formatted paragraph text.
I almost forgot. I am also going to use it to dynamically edit a batch of multi-line code snippets which are used as reference files for macro shortcut key actions.
I am particularly excited to turn this into a drop in dynamic range reference locally run AI summarizer tool! My reports formulaically identify / list revenue enhancement opportunities as well as the potential upside to addressing them. (Inserting these comments into a long report structure is another nice basic use case for the component) I particularly love the idea of being able to instantly drop in a component that takes formula generated report comment data (along with some writing examples, business use case background, summary tables, etc.) and replaces or inserts AI generated clean, well written and pre-formatted paragraph text.
This is an ideal use case. Template with AI.
Your “highly customized Point of Sale touchscreen presentations for business clients” is also a great case. I never imagined this, and this approach seems pretty maintainable.
I think this is actually meta programming. I believe I have understand it totally.
I had never heard the term Metaprogramming, but that certainly seems to fit some of my projects. I need to study up on my tech terms and acronyms at some point… The other day I was asked about some of my AI workflow integrations and the other person said, “It sounds like you are describing the new AI approach of Table Augmented Generation or TAG”. Of course, the only new part is that someone recently coined a name / acronym for it. Plenty of us KNIME users have been embedding tabular data into queries since Open AI API was available for beta testing. We should have put our heads together and tried to coin a tech term for it!