Popup Window in Workflow

Hey Guys,

i got a rule engine component where i have to put in a date which i getting written into the output data table.
Is there a way, when i execute the workflow, that a popup window shows up and i enter the date in the popup window field and it gets written in the rule engine component, so i dont have to open the component separately and then execute the workflow.
Its basically a easier way for my colleagues to start the workflow without knowing where they have to update the date for the output file.

Thanks and kind regards

Hi @Aco_Krivo. Sure, you can use the ndoe:
imagen

1 Like

Hi there,

another purist solution from my side, as I never clicked with these mega-fiddly “Widget” nodes (KNIME definitely deserves a :trophy: for the most complicated and stressful “Close” button I’ve ever seen!).

What I usually do when a workflow requires direct interaction: Put a Java Snippet node which opens a javax.swing.JOptionPane:

out_password = JOptionPane.showInputDialog(null, "Enter password");

Execute the node, the dialog will pop up, enter the data, and execution will continue.

When you use a Java Edit Variable node, make sure to check Run only on execution on the options.

Hope this helps!

–Philipp

4 Likes

Thanks for the quick replies guys!
Ive tried it with the Java Snippet but cant get it to work :frowning:

I’ve copied your code into the expression_start field and i’ve changed the column name
and added an output field.
I alwas get the following error messag:
Error in line 29: JOptionPane cannot be resolved.
Is there a way to fix this without annoying you too much :sweat_smile:

Let’s try :stuck_out_tongue:

Sorry, I forgot that you’ll need to add the following import (at the very top):

import javax.swing.JOptionPane;

Alternatively, if you want a one liner without explicit import, you can just do:

out_password = javax.swing.JOptionPane.showInputDialog(null, "Enter password");

Note, that out_password must be declared in the “Output” section at the end of the configuration.

Let me know if you’re still having trouble and I can upload an example workflow!

–Philipp

2 Likes

Update: Here’s an example workflow:

2 Likes

Thxxx Phillip it works great ur a legend!!

Is there also the possibility that the input is inserted in all lines? Or do i always have
to type the date for every line?

@Aco_Krivo Happy to hear, thanks for the feedback :slight_smile:

Is there also the possibility that the input is inserted in all lines? Or do i always have
to type the date for every line?

Sure – here’s two ideas how to do it:

  • Use the second variant in the example workflow which works via flow variables as a foundation. Use a Variable to Table Column node to append the value from the flow variable to the table.

  • When you use the first example, modify the code in the Java Snippet node as follows:

    // Your custom variables:
    String text;
    
    // -----------------------------
    
    // Enter your code here:
    if (text == null) {
       text = javax.swing.JOptionPane.showInputDialog(null, "Hello human, what’s your name?");
    }
    
    out_name = text;
    

Hope this helps! :slight_smile:

–Philipp

PS: I have updated the workflow on my NodePit space with two examples for what I described above.

4 Likes

Thank you so much Phillip it works great.
I’ve already shown it to my colleagues and they love it.

Have a nice weekend!

3 Likes

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