Default ouput value from component interactive view

Hello,

For the context, when components are made with for example a table view; the table will be accessible through the “Interactive View” of the component and you will be able to select row. When you close the Interactive View you can “Close & Apply settings as new default”. If you do, you can Reset the component, relaunch it and then the previously selected row are still selected : ie the default values has been conserved => great

Now my case: I made a component with inside a Generic Javascript view. This node generate a view based on the input data column (with forms containing “Select Input” allowing to select columns from the input data). It has in output variables filled based on the selected values in the Interactive view.

The problem: I select a choice in the “Select input” of the form and the output variable is correct. But when I “Close & Apply settings as new default” than I “Rest” the component => the default values are not conserved.

Question: What is needed for the Generic Javascript View to conserve the Default values that have been set by the user?

Thanks in advance,

Lionel

Hi all,

Any idea on how to do for the Generic Javascript View node to conserve the default value saved by the user?

Lionel

Hi @lcollia -

I’m not sure offhand, but let me ask internally and see what I can find out…

1 Like

Hi Lionel,
so I talked a bit with @blaney
Apparently it is not possible to save defaults with Generics JS node.

@paolotamag: “do you if we have any example with JavaScript to show this guy where after “Close & Apply settings as new default” would actually save the custom js interaction even after reset of component/view? is this even possible?”

@blaney : that’s not possible via the Generic JavaScript View. The best thing you can do with the Generic JS View is publish updates to other nodes and save their settings. I made an example of a custom filter event with the Generic JavaScript View here (How to Publish/Subscribe Events using Custom Javascript Views). Maybe this will help?

@paolotamag : it won’t help has most of views cannot update their defaults settings via interaction events (subscribing to selection or filter event of the Generic JavaScript node).

@albrecht : 1. There is a SETTINGS object on the Generic JS View, which can be used to temporarily store data (which will be lost on reset, but survives a reopen of the view)
2. It is only possible for the interactive filter nodes to update their defaults. It is not possible that a selection that has been published to e.g. a table view would be persisted. A default selection is something that we currently don’t have (at least for most views).

@paolotamag : the only way I could think of where you can change default settings of an entire component via a generic js node is using its output flow variable generated on “Apply” button or its variant. Such flow variable can depend on interaction events defined in the JavaScript and it can be used as input settings with other nodes. However when you reset the component the flow variable output value will go back to default initial value so everything which depends on that flow variable will go back to its initial settings. So it will work on “Apply&Close” but not for “Apply&Close settings as new default”

1 Like

Hi @paolotamag, @blaney, @albrecht,

I am not sure to fully undertand your point with the knimeService events; but I understand that it could be a way to keep the users choice in a SETTINGS object while the component is not reset (tutorial on how to use knimeService is welcomed :smiley: )

@paolotamag, what you explained in your last comment is exactly my problem; I can get the output variable after the user has interacted with the view, but I cannot get the default output variable value after the component has been reset. (whereas it work with other interactive nodes like @albrecht explained).

In a few words, my problem is not to obtain the interactive view as it had been when the user Apply & Close; but to change the default output variable value with the well named menu “Close & Apply a New Default”.

So you can think of a solution, you are welcomed :smiley:

Lionel

2 Likes

I am thinking of a potential solution, but I am not sure it could work.

If you have in the same component (and thus interactive View) a Generic Javascript View AND a String Widget (that is able to save the changed default value).
Inside the Generic Javascript View; can I :

  • obtain the default value of the String Widget ?
  • set the value of the String Widget ?

If yes to both, then I should be able to use the output of the String Widget in my flow, and use the Generic Javascript View only for the Interactive View (with the String Widget hidden).

@paolotamag, @blaney, @albrecht, Do you think this solution is possible?

Lionel

Hi,

@paolotamag, @blaney, @albrecht, Do you think the solution I was thinking in the previous reply is possible?

Thanks in advance,

Lionel

Hi, sorry for the late reply,
the only way to change the initial value of the flow variable would be via interacting with the String Widget.

You want to interact with the custom Generic JavaScript View instead. Therefore even if the Generic JS View starting flow variable value is depending on what has been saved in the String Widget flow variable (new default or dialogue settings default), when interacting with your custom Generic JS view you won’t be able to change this new default flow variable to be saved in the String Widget and used next time the view is opened. This because it would be creating a loop connection between 2 nodes. Widget to JS View and JS View to Widget, KNIME won’t even let you do that.

Now this is if I understood correctly your question. Best way would be to open KNIME AP and try and send us what you got :slight_smile:

I cannot test this solution if I do not know some specific cmd that I need (so I cannot send you what I have :D)

If I have one Interactive View, generated with two nodes (Generic Javascript View AND String Widget); can you give me the javascript cmd to interact with the string input form inside the Generic Javascript View ?
In particular:

  • obtain the value of the String Input form from the String Widget ?
  • set the value of the String Input form from the String Widget ?

Thanks in advance

I see what you mean now, I will ask to @albrecht (developer at KNIME) and get back to you asap.

1 Like

Hello again,
we understand the need in your case but in general we do not support the JavaScript API to escape the Generic JavaScript view assigned iframe. I am sorry we cannot help you.
Best of luck,
Paolo

Hello @paolotamag,

Thank you for this answer. I understand this point of view.

Thus, I hope in a next release the “Close & Apply settings as new default” will overwrite the default value of the Generic Javascript View node, as it is currently for some of the others JS widget. (I imagine that the default value could be overwrite at least until the interactive view is reopened).

If needed we could talk about this in Berlin next month :wink:

Regards, Lionel

2 Likes

You are right I will open a ticket for that.
Thanks for your understanding!
happy to see you joining the KNIME Spring Summit 2020!
See you there then!
Paolo

1 Like

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