Call the workflow table based on the variable that does not accept with the path

Hi, I have a main workflow that I use several times with different input files. I would need to call a second workflow via variable workflow, I tried the Call Workflow (Table Based) but I can’t pass the path of the second workflow.The path written directly in the node works correctly, can anyone help me?

If it’s not possible with table based is it possible in some other way? The important thing is that you can call via variable
If it helps, the main wkf and the one called are in two different paths

Hi,
Have you tried the Call Workflow Service together with Workflow Service Input and the corresponding Workflow Service Output nodes? Call Workflow Service definitely works with flow variables, I have done it before. It is also the better option if you do not want to invoke the callee workflow from outside of KNIME, as it uses a more efficient proprietary format for data representation (Call Workflow (Table Based) uses JSON).
Kind regards,
Alexander

1 Like

Hi, thanks, no I haven’t tried the call workflow service, I’ll try to find some examples

1 Like

@cridiaz I can offer these examples. Best to load the whole workflows group each.

This one communicates between main and sub workflow via JSON files

This example exchanges tables and Flow Variables between main and sub:

Thank you both for the proposed solutions I will do some testing I only have one other question when I launch it in batch mode the called wkf must be in the same work directory as the caller or it can be in another path and how should I indicate the path
Thank you
@mlauber71 thank you, I had seen your examples and it was from those that the idea came from but I couldn’t quite understand how it worked

@cridiaz I reworked some of the workflows and updated to the new call workflow environment. This now seems to be easier to understand. You configure a sub-workflow with inputs and outputs and then you point the main-workflow to the sub-workflow and apply the settings so magically the input and output ports will appear like in the sub-workflow. And I think you can then work with them.

Another example just stores data locally and then loads them in the sub-workflow but maybe that is not so elegant.

There is another framework where you can execute something like a compacted workflow called “Integrated Deployment”:

https://docs.knime.com/latest/integrated_deployment_guide/index.html#introduction

Hello thank you @mlauber71 I didn’t understand in your first example that it has the call to another wkf via JSON I always have the problem of knowing how and where I should put the wkf that I have to recall because in my case I have the first wkf that I call DB_GEN in a path saved as zip and launched via batch and the second which I call LK always in zip and which I should use in the first but I don’t know if I should copy it into the work folder of the first

@cridiaz from my experience it would be best to provide the paths via a workflow variable in the batch. The path should not have any blanks or funny characters. You can call the sub-workflow directly and do not need to use the JSON communication.

A basic batch/cmd file might look like this:

REM Set the path to your KNIME executable (Windows)
set KNIME_PATH=C:\Users\%USERNAME%\software\knime_4.7.0\knime.exe

REM Set the path to your workflow directory (the workflow you want to run)
set WORKFLOW_DIR=C:\Users\%USERNAME%\knime-workspace\KNIME_Batch\KNIME_Batch_Workflow

REM Set a string variable to pass to the workflow (a variable to bed used in workflow)
REM you have to define them as workflow variable in in WF
set STRING_VAR_NAME=var_data_path
set STRING_VAR_VALUE=C:\Users\%USERNAME%\knime-workspace\KNIME_Batch\data\

REM Run KNIME in batch mode with the specified workflow, string variable, proxy settings, and save the log output
"%KNIME_PATH%" -reset -nosave -nosplash -application org.knime.product.KNIME_BATCH_APPLICATION -workflowDir="%WORKFLOW_DIR%" ^
-workflow.variable=%STRING_VAR_NAME%,%STRING_VAR_VALUE%,String

You would have to set the “var_data_path” as Workflow Variable in the workflow. That would later be replaced by the value sent thru the CMD batch file.

image

image

2 Likes

thx i will try soon :slight_smile:

2 Likes

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