Dear Taverna users and developers,
I need a beanshell service that takes three input parameters. Two of
those should be optional, meaning that the user does not have to
bother with supplying any value when running the workflow. I have been
looking around in the Taverna manual and mailing list, but I haven't
found a solution yet.
My simple testing beanshell (see below) takes three input strings and
returns some text: 'input 1 has value x' etc. or, in case the user
decides not to provide a value, 'input 1 has no value'. I
tried/considered these options for the workflow (points 1 and 2
provide 'optional value', points 3 and 4 provide 'default value'. If
possible, I want it to be 'optional value' if you get what I mean):
1. give the beanshell its three desired input ports but simply give no
input value when running the workflow. This generates a
'java.lang.RuntimeException: No input data supplied' error, which
makes sense.
2. use 'if (input1.equals(""))' in the beanshell and when running the
workflow, click the input port, click add new value but then leave the
textbox empty (or use the example value?). This works but is not
desirable, the user should be able to not bother about this particular
port at all.
3. set the 'Constant value' for the input port. This doesn't work, the
option 'Constant value' is greyed out.
4. connect a String Constant to the port. For example set the string
constant to "no value" and use 'if(input1.equals("no value"))' in the
beanshell. Taverna runs the workflow with all available input
combinations and returns a list of lists with all outcomes. This has
two major implications for the rest of my workflow: 1. which output
value should I use as input for my next service? and 2. this brings in
additional services splitting the list of lists to extract that
particular value. This is undesirable in a complex workflow, which
mine will eventually be.
Does anyone have an idea how to solve this?
Many thanks,
Wil
The (very) simple testing beanshell:
<code>
// input ports: input1 (optional String), input2 (optional String),
input3 (required String)
output = ""
if (input1==void) { // or input1.equals("")
output += "no value supplied for input1\n";
} else {
output += "input1 has value: " + input1 + "\n";
if (input2==void) {
output += "no value supplied for input2";
} else {
output += "input1 has value: " + input2 + "\n";
output += "input3 has value: " + input3;
</code>
------------------------------------------------------------------------------
_______________________________________________
taverna-users mailing list
[email protected]
[email protected]
Web site: http://www.taverna.org.uk
Mailing lists: http://www.taverna.org.uk/about/contact-us/