I was finally able to create a component that allows me to interactively add user inputted line items to a table. You can find this here:
Now I feel - from a user experience point of view - that it’s a bit difficult to have users ADDING line items but not being able to delete them, e. g. in case they made a mistake when entering data.
Maybe someone can nudge me in the right direction to help me come up with an idea. I played around with the Table Editor (JavaScript) Node but didn’t get very far. I also tried to implement a second Refresh button Widget Node but that somehow made it only worse.
So here’s my workflow (only with the feature to add line items):
Any idea how I can implement the Deletion functionality?
ps: If possible, I would love to do it the low code way and not use Python / Java for example.
I took a look at the workflow - the strange behaviour you mentioned I observed as well. I think this happens whenever you leave the component and apply changes temporarily / as new default. It looks like the component runs another full execution with the current values in it (you can actually briefly see how the traffic light changes from green and the “running” animation is visible.
With regards to your question around deletion:
Is it an option to add a single selection widget with options add and delete (maybe as radio buttons) and the define the different logic via Case Switch where you have one pathway depending on the selection for the radio buttons add / delete.
You’d have to modify the table view to include the selection boxes for each item so that the user can choose the one’s to be deleted.
The other alternative: Can you have one component for adding / one for deleting?
Thanks a lot for your input @MartinDDDD - I have solved the ‘minor’ issue of adding rows twice by using a Row Filter Node for all items with RowID ‘values’ (which always seems to be the duplicate entry).
With regards to your proposal for deletion: yes, this would definitely be an option. I tried to scribble out, what I have understood.
Do you mean something like this? So the String Widget Node / user input would simply be ignored, if the user chose ‘delete’ as an option?
I would also probably switch from the pure Table View Node to the Table Editor (JavaScript) Node, as I can make selections in the Table View Node, but I don’t really understand how to read them out.
Yep exactly like that - I played around a bit (couldn’t help it).
This is what I had in mind - that said it is still a bit buggy - might need a third radio button “refresh only” and a third branch in the case switch start node… Maybe something you can expand on Adding_deleting Line Items to a Table.knwf (100.7 KB)
I tried to work off of this but somehow, this solution still has some flaws.
The Refresh Button Widget only seems to work if you press it twice, when you choose the ‘add’ option. I don’t really understand why it sometimes works and sometimes not. Could this be a performance issue, that the reload is faster than writing the table locally to disk?
I added some logic - basically a Rule Engine - to reset all selection values to false. However, when the Table View Node gets updated, it still shows the same selection. Maybe same issue as 1?
To not execute the desired action twice, you should always close by discarding (so to say). This is not the user friendliest option, I guess, but I couldn’t come with a rule (e. g. for the Rule Engine Row Filter Node) that deletes double entries. I understand that components are also made for the KNIME Business Hub and there you probably don’t have the issue of having to close a component, but anyways…
So here’s my solution so far, not really sure, how to proceed…