VMware Cloud Community
BillSkulley
Contributor
Contributor
Jump to solution

vCO REST: Array of Numbers

I've been struggling with this one for longer than I care to admit.

I have a simple workflow that just takes an input array and logs the contents.  An array "hello world" if you will:

for each (var thing in myvar) {
  System.log("Thing: "+thing);

}

When using an Array/string type for myvar, this XML section passed via the REST API works perfectly:

    <vco:parameter name="myvar" type="vco:array">

      <vco:array>

        <vco:string>"5.0"</vco:string>

        <vco:string>"10.0"</vco:string>

      </vco:array>

    </vco:parameter>

However, when changing the input array type to Array/number, the XML below is accepted and the workflow runs but the array elements consistently appear as "not entered" or "null":

    <vco:parameter name="myvar" type="vco:array">

      <vco:array>

        <vco:number>"5.0"</vco:number>

        <vco:number>"10.0"</vco:number>

      </vco:array>

    </vco:parameter>

I've tried various permutations of sindle/double/no quotes, inline value attributes, etc, all to no avail.  I saw that when running the workflow via the vCO UI the value was logged as name=myvar, type=Array/number, value=#{#number#5.0#;#number#10.0#}# but various permutations of this form...

  <vco:parameters>
    <vco:parameter name="myvar" type="vco:array">#{#number#325.0#;#number#215.0#}#</vco:parameter>
  </vco:parameters>


... still return "not entered".  The doc at https://<vco>/api/docs/el_vco_execution-context.html don't seem to indicate any special handling requirements for an array of numbers, but I'm apparently missing something fundamental.

Any tips/pointers/recommendations greatly appreciated!

Thanks!

Reply
0 Kudos
1 Solution

Accepted Solutions
igaydajiev
VMware Employee
VMware Employee
Jump to solution

Try setting the parameter type to "Array/number"".

<parameter name="myvar" type="Array/number">
    <array>
        <number>123.0</number>
        <number>4213.0</number>
     </array>
</parameter>

View solution in original post

Reply
0 Kudos
2 Replies
igaydajiev
VMware Employee
VMware Employee
Jump to solution

Try setting the parameter type to "Array/number"".

<parameter name="myvar" type="Array/number">
    <array>
        <number>123.0</number>
        <number>4213.0</number>
     </array>
</parameter>
Reply
0 Kudos
BillSkulley
Contributor
Contributor
Jump to solution

Perfect!

<vco:parameters>
    <vco:parameter name="myvar" type="vco:Array/number">
      <vco:array>
        <vco:number>111.0</vco:number>
        <vco:number>777.0</vco:number>
      </vco:array>
    </vco:parameter>
  </vco:parameters>

I have no idea how I missed that permutation, but I guess everything is obvious in retrospect! Smiley Happy

Thanks!

Reply
0 Kudos