<p>My suggestion is to set job parameterized with two options, and just set up variables in the Shell Build step, like this:</p>

<pre><code>if [ "$VAR" == "1" ]; then
    value1="1.0.0"
    value2="myname"
    value3="build/libs"
elif [ "$VAR" == "2" ]; then
    value1="2.0.0"
    value2="myname2"
    value3="var/lib"
fi

echo ${var.value1}
echo ${var.value2}
echo ${var.value3}
</code></pre>

CC BY-SA 3.0
2017-09-29T23:23:03.240Z
2017-09-29T23:23:03.240Z
vertrost
<p>Hello I want the following behaviour.</p>
<p>A want my job to be parametrized. The thing is that I want to select a unique parameter with multiple values.</p>
<p>I have a unique parameter named number with 2 options (1, 2) and then set of values linked to each option:</p>
<blockquote>
<p>Parameter name: var</p>
<p>Options:</p>
<p>1</p>
<p>2</p>
</blockquote>
<p>Let´s say:</p>
<ul>
<li>One set of values:</li>
</ul>
<blockquote>
<ul>
<li>value1: &quot;1.0.0&quot;</li>
<li>value2: &quot;myname&quot;</li>
<li>value3:&quot;build/libs&quot;</li>
</ul>
</blockquote>
<ul>
<li>Another set of values:</li>
</ul>
<blockquote>
<ul>
<li>value1: &quot;2.0.0&quot;</li>
<li>value2: &quot;myname2&quot;</li>
<li>value3: &quot;var/lib&quot;</li>
</ul>
</blockquote>
<p>In the &quot;Build section&quot; I select &quot;Execute shell&quot; with the following lines:</p>
<pre><code>echo ${var.value1}
echo ${var.value2}
echo ${var.value3}
</code></pre>
<p>So when building the job I would like to select from a dropdown list with 2 values as said above: 1 and 2.</p>
<p>If I select 1, I would like to take the first set of values so that it would dislplay:</p>
<pre><code>1.0.0
myname
build/libs
</code></pre>
<p>On the other hand if I select 2, I would like to display the second set of values:</p>
<pre><code>2.0.0
myname2
var/lib
</code></pre>
<p>I have tried &quot;Extended Choice Parameter plugin&quot; but I don´t know how to manage this situation.</p>
<p>Thank you.</p>

<jenkins>
Jenkins Select unique parameter with multiple values
joudaon
# Jenkins Select unique parameter with multiple values

(Asked by: username_0 on 2017-09-06)

Hello I want the following behaviour.
A want my job to be parametrized. The thing is that I want to select a unique parameter with multiple values.
I have a unique parameter named number with 2 options (1, 2) and then set of values linked to each option:

Parameter name: var
Options:
1
2

Let´s say:

One set of values:



value1: "1.0.0"
value2: "myname"
value3:"build/libs"



Another set of values:



value1: "2.0.0"
value2: "myname2"
value3: "var/lib"


In the "Build section" I select "Execute shell" with the following lines:
echo ${var.value1}
echo ${var.value2}
echo ${var.value3}

So when building the job I would like to select from a dropdown list with 2 values as said above: 1 and 2.
If I select 1, I would like to take the first set of values so that it would dislplay:
1.0.0
myname
build/libs

On the other hand if I select 2, I would like to display the second set of values:
2.0.0
myname2
var/lib

I have tried "Extended Choice Parameter plugin" but I don´t know how to manage this situation.
Thank you.

**Tags:** jenkins


---

## 1 answers

### Answer by username_1 on 2017-09-29. Score: 1 | Accepted answer

My suggestion is to set job parameterized with two options, and just set up variables in the Shell Build step, like this:
if [ "$VAR" == "1" ]; then
    value1="1.0.0"
    value2="myname"
    value3="build/libs"
elif [ "$VAR" == "2" ]; then
    value1="2.0.0"
    value2="myname2"
    value3="var/lib"
fi

echo ${var.value1}
echo ${var.value2}
echo ${var.value3}


---

