Variables Mapping of Array List

I am currently using Zeebe to implement my scene.
Start->TaskA->TaskB->End
The TaskA return value is a List type: A_Response a_Response

        public class A_Response
        {
            public List<A_Detail> A_Details { get; set; }
        }
        public class A_Detail
        {
            public string Prop1 { get; set; }
            public string Prop2 { get; set; }
            public string Prop3 { get; set; }
            public string Prop4 { get; set; }
        }

The input parameter of TaskB is also a List type:

        public class B_Command
        {
            public List<B_Args> Args { get; set; }
        }
        public class B_Args
        {
            public string Prop1 { get; set; }
            public string Prop2 { get; set; }
            public string Name { get; set; }
            public string Age { get; set; }
        }

How do I map A_Response to B_Args? Because of the Name in B_Args, the Age attribute is derived from other key in Variable.How to map the prop2, prop3 of response to name, age

Two options:

  1. Use JavaScript; or
  2. Use the output mappings on the task in the BPMN to map the variables.

For option 2, see: https://docs.zeebe.io/bpmn-workflows/service-tasks.html#variable-mappings

It’s in the task properties panel in the Zeebe Modeller.

Hi,jwulf.
Let me give you an example:
Use the above process, as well as parameters, return values.
Q1:
The data returned by TaskA is

{
“a_Details”: [
{
“prop1”: “string1”,
“prop2”: “string1”,
“prop3”: “string1”,
“prop4”: “string1”
},
{
“prop1”: “string2”,
“prop2”: “string2”,
“prop3”: “string2”,
“prop4”: “string2”
},
{
“prop1”: “string3”,
“prop2”: “string3”,
“prop3”: “string3”,
“prop4”: “string3”
}
]
}

The input parameters of my TaskB need to be constructed as follows:
{
“args”: [
{
“prop1”: “string1”,
“prop2”: “string1”,
“name”: “name1”,
“age”: “20”
},
{
“prop1”: “string2”,
“prop2”: “string2”,
“name”: “name2”,
“age”: “21”
},
{
“prop1”: “string3”,
“prop2”: “string3”,
“name”: “name3”,
“age”: “22”
}
]
}

Can I do conversion between arrays in In/OutMapping? And the Count of this array is not fixed. My description is googled, it may not be smooth, sorry…

#############################################################
Q2:
waitOutStockCreateResponse.waitOutStockDetails is List Type,i want to get the first item:

This method is wrong.I changed another method:

No. You’ll need to transform the data in your worker, or write an intermediate task worker to do it.

1 Like

hi, @jwulf. Currently there is planned support the conversion between arrays in In/OutMapping?(C# client)

by the way.
1). Feature request: Awaitable Workflow outcomes :When will this issue be supported?(C# client)
2). Will the Zeebe framework plan to charge?

Hi @walt-liuzw,

The C# question is one for @Zelldon. See here: https://github.com/zeebe-io/zeebe-client-csharp/issues/34

It is supported in broker 0.22. Broker alpha release here: https://hub.docker.com/r/camunda/zeebe/tags.

No API changes planned that I know of. Internal changes happening around performance.