# Passing a fixed array of strings to a step input

**URL:** <https://cwl.discourse.group/t/passing-a-fixed-array-of-strings-to-a-step-input/391>\
**Category:** CWL Questions\
**Created:** [June 25, 2021, 6:34am UTC](https://cwl.discourse.group/t/passing-a-fixed-array-of-strings-to-a-step-input/391 "2021-06-25T06:34:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FabriceBrito](https://yyz2.discourse-cdn.com/free1/user_avatar/cwl.discourse.group/fabricebrito/32/114_2.png) [@FabriceBrito](https://cwl.discourse.group/u/FabriceBrito)\
**Post date:** [June 25, 2021, 6:34am UTC](https://cwl.discourse.group/t/passing-a-fixed-array-of-strings-to-a-step-input/391/1 "2021-06-25T06:34:57Z")

</div>

Hello,

I’ve got a workflow step input that is used as a scatter parameter and whose values are a fixed list of strings: I want that step to scatter on [“IW1”, “IW2”, “IW3”]

I’ve got this far:

```auto
- class: Workflow
  doc: SNAP SAR Calibration
  id: main
  inputs:
    #subswath:
    # type: string[]
    primary:
      doc: Sentinel-1 SLC primary product SAFE Directory
      label: Sentinel-1 SLC primary product SAFE Directory
      type: Directory
    secondary: 
      doc: Sentinel-1 SLC secondary product SAFE Directory
      label: Sentinel-1 SLC secondary product SAFE Directory
      type: Directory
  label: SNAP SAR Calibration
  outputs:
  - id: wf_outputs
    outputSource:
    - node_3/results
    type: Directory
      
  requirements:
  - class: ScatterFeatureRequirement
  - class: SubworkflowFeatureRequirement
  - class: StepInputExpressionRequirement
  - class: InlineJavascriptRequirement

  steps:
    node_01:
      in: 
        input_reference: primary
      out:
      - results
      run: '#stac2safe'
    node_02:
      in: 
        input_reference: secondary
      out:
      - results
      run: '#stac2safe'
    node_1:
      in:
        inp1: node_01/results
        inp2: node_02/results
        inp3: 
          valueFrom: ["IW1", "IW2", "IW3"]
      out:
      - results
      run: '#ifg'
      scatter: inp3
      scatterMethod: dotproduct
    node_2:
      in: 
        inp1: 
          source: node_1/results
          valueFrom: |
            ${
              return self[0]; 
            }
        inp2: 
          source: node_1/results
          valueFrom: |
            ${
              return self[1];
            }
        inp3: 
          source: node_1/results
          valueFrom: |
            ${
              return self[2];
            }

```

This outputs:

```auto
INFO /srv/conda/bin/cwltool 3.0.20210319143721
INFO Resolved 'gpt-stac-topsar-stac.cwl' to 'file:///home/fbrito/work/cwl-snap-graph-topsar/gpt-stac-topsar-stac.cwl'
ERROR Tool definition failed validation:
gpt-stac-topsar-stac.cwl:163:3: Object `gpt-stac-topsar-stac.cwl#main` is not valid because
                                   tried `Workflow` but
gpt-stac-topsar-stac.cwl:190:3: the `steps` field is not valid because
                                       tried array of <WorkflowStep> but
gpt-stac-topsar-stac.cwl:203:5: item is invalid because
gpt-stac-topsar-stac.cwl:204:7: the `in` field is not valid because
gpt-stac-topsar-stac.cwl:207:9: item is invalid because
gpt-stac-topsar-stac.cwl:208:11: the `valueFrom` field is not valid because
                                                 value is a CommentedSeq, expected null or string
                                                 or Expression

```

Am I missing something obvious? I’ve tried several combinations while looking at similar questions but no luck.

PS: CWL really simplifies our life 😉

---

<div class="post-metadata">

**Author:** ![tate](https://yyz2.discourse-cdn.com/free1/user_avatar/cwl.discourse.group/tate/32/391_2.png) [@tate](https://cwl.discourse.group/u/tate)\
**Post date:** [June 27, 2021, 9:19pm UTC](https://cwl.discourse.group/t/passing-a-fixed-array-of-strings-to-a-step-input/391/2 "2021-06-27T21:19:36Z")

</div>

Per the specification for WorkflowStepInput ([Common Workflow Language (CWL) Workflow Description, v1.2](https://www.commonwl.org/v1.2/Workflow.html#WorkflowStepInput)), accepted types for `valueFrom` are limited to string and Expression. You’ll notice that the accepted type for `default` is Any.

What happens if you instead use `default` rather than `valueFrom`?

---

<div class="post-metadata">

**Author:** ![FabriceBrito](https://yyz2.discourse-cdn.com/free1/user_avatar/cwl.discourse.group/fabricebrito/32/114_2.png) [@FabriceBrito](https://cwl.discourse.group/u/FabriceBrito)\
**Post date:** [June 28, 2021, 1:00pm UTC](https://cwl.discourse.group/t/passing-a-fixed-array-of-strings-to-a-step-input/391/3 "2021-06-28T13:00:58Z")

</div>

Thanks for your feedback @tate

I’ve tried using an Expression but I must have done that the wrong way.

This works fine:

```auto
   node_01:
     in: 
       input_reference: primary
     out:
     - results
     run: '#stac2safe'
   node_02:
     in: 
       input_reference: secondary
     out:
     - results
     run: '#stac2safe'
   node_1:
     in:
       inp1: node_01/results
       inp2: node_02/results
       inp3: 
         default: ["IW1", "IW2", "IW3"]
     out:
     - results
     run: '#ifg'
     scatter: inp3
     scatterMethod: dotproduct

```

Thanks!
