Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
<tool name="Compose text parameter value" id="compose_text_param" version="0.1.1" profile="19.05" tool_type="expression">
<description>from parameters</description>
<expression type="ecma5.1">
{
let s = "";
for (const repeat of $job.components) {
s += repeat.param_type.component_value
};
return {'output': s};
}
</expression>
<inputs>
<repeat name="components" min="1">
<conditional name="param_type">
<param name="select_param_type" type="select" label="Choose the type of parameter for this field">
<option value="text">Text Parameter</option>
<option value="integer">Integer Parameter</option>
<option value="float">Float Parameter</option>
</param>
<when value="text">
<param name="component_value" type="text" label="Enter text that should be part of the computed value">
<sanitizer sanitize="false"/>
</param>
</when>
<when value="integer">
<param name="component_value" value="" type="integer" label="Enter integer that should be part of the computed value"/>
</when>
<when value="float">
<param name="component_value" value="" type="float" label="Enter float that should be part of the computed value"/>
</when>
</conditional>
</repeat>
</inputs>
<outputs>
<output type="text" name="out1" from="output" />
</outputs>
<tests>
<test>
<repeat name="components">
<conditional name="param_type">
<param name="select_param_type" value="text"/>
<param name="component_value" value="Text: "/>
</conditional>
</repeat>
<repeat name="components">
<conditional name="param_type">
<param name="select_param_type" value="text"/>
<param name="component_value" value="value,"/>
</conditional>
</repeat>
<repeat name="components">
<conditional name="param_type">
<param name="select_param_type" value="text"/>
<param name="component_value" value=" Integer: "/>
</conditional>
</repeat>
<repeat name="components">
<conditional name="param_type">
<param name="select_param_type" value="integer"/>
<param name="component_value" value="1"/>
</conditional>
</repeat>
<repeat name="components">
<conditional name="param_type">
<param name="select_param_type" value="text"/>
<param name="component_value" value=", Float: "/>
</conditional>
</repeat>
<repeat name="components">
<conditional name="param_type">
<param name="select_param_type" value="float"/>
<param name="component_value" value="1.5"/>
</conditional>
</repeat>
<output name="output">
<assert_contents>
<!-- <has_line line="'"Text: value, Integer: 1, Float: 1.5"'"/> -->
<has_line line="&quot;Text: value, Integer: 1, Float: 1.5&quot;"/>
</assert_contents>
</output>
</test>
<test>
<repeat name="components">
<conditional name="param_type">
<param name="select_param_type" value="text"/>
<param name="component_value" value="Text: "/>
</conditional>
</repeat>
<repeat name="components">
<conditional name="param_type">
<param name="select_param_type" value="text"/>
<param name="component_value" value="value with; &gt; &amp; and !"/>
</conditional>
</repeat>
<output name="output">
<assert_contents>
<!-- <has_line line="'"Text: value, Integer: 1, Float: 1.5"'"/> -->
<has_line line="&quot;Text: value with; &gt; &amp; and !&quot;"/>
</assert_contents>
</output>
</test>
</tests>
<help><![CDATA[
This tool concatenates each parameter value to a string.
If used in a workflow you can connect the output to any
text parameter value.
]]></help>
</tool>