# Accessing multiple parameter values in a single task

**URL:** <https://cylc.discourse.group/t/accessing-multiple-parameter-values-in-a-single-task/1006>\
**Category:** Cylc Support\
**Created:** [August 13, 2024, 9:58am UTC](https://cylc.discourse.group/t/accessing-multiple-parameter-values-in-a-single-task/1006 "2024-08-13T09:58:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stewells](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@stewells](https://cylc.discourse.group/u/stewells)\
**Post date:** [August 13, 2024, 9:58am UTC](https://cylc.discourse.group/t/accessing-multiple-parameter-values-in-a-single-task/1006/1 "2024-08-13T09:58:57Z")

</div>

Hello,

I have a set of parameters defined as  
[cylc]  
[[parameters]]  
vars = a,b,c  
which get used in the workflow to run separate tasks, e.g  
foo =\> bar\<`vars`\>

I have another task that only runs once, but needs knowledge of all the parameter values defined by “vars” to be used as arguments to a script , e.g  
[[my\_new\_task]]  
script = “”"  
my\_script.sh a b c  
“”"

Could you provide any pointers on how best to achieve this please? Currently being run with Cylc 7.8.14 but in process of porting to cylc8 so a solution that can be applied to both would be most helpful.

Many thanks,

---

<div class="post-metadata">

**Author:** ![oliver.sanders](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/oliver.sanders/32/110_2.png) [@oliver.sanders](https://cylc.discourse.group/u/oliver.sanders)\
**Post date:** [August 13, 2024, 10:04am UTC](https://cylc.discourse.group/t/accessing-multiple-parameter-values-in-a-single-task/1006/2 "2024-08-13T10:04:41Z")

</div>

We usually use Jinja2 to achieve this e.g:

```ini
#!Jinja2

{% set params=['a', 'b', 'c'] %}

[task parameters]
    param = {{ params | join(', ') }}

[scheduling]
    [[graph]]
        R1 = foo => bar<param>

[runtime]
    [[my_new_task]]
        script = my_script.sh {{ params | join(' ') }}

```

To see how this evaluates, use the `cylc view -p` command:

```console
$ cylc view -p .
[task parameters]
    param = a, b, c
[scheduling]
    [[graph]]
        R1 = foo => bar<param>
[runtime]
    [[my_new_task]]
        script = my_script.sh a b c

```

---

<div class="post-metadata">

**Author:** ![stewells](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@stewells](https://cylc.discourse.group/u/stewells)\
**Post date:** [August 13, 2024, 10:18am UTC](https://cylc.discourse.group/t/accessing-multiple-parameter-values-in-a-single-task/1006/3 "2024-08-13T10:18:08Z")

</div>

Perfect, thanks Oliver
