Parsing "Connector in" result using a Select widget

1
0
-1

Hi,

I have a "connector in" which sends the a query result (list) to one Process Variable.
The resulting array has 2 "columns".

When calling the Process variable from the UI form, using a UI variable (with External API call), I don't know how to parse the result.

The select widget is supposed to show a list of departments. i.e.:
Aires Acondicionados"
Administrativo
Aprovisionamiento
...etc

but when calling the values through the variable using this statement departments.value .... all I get is this:
[ "AA", "Aires Acondicionados" ]
[ "AD", "Administrativo" ]
[ "AP", "Aprovisionamiento" ]
... etc

Here are my questions:
Could you please tell me what I am doing wrong when parsing the result?
Could you please tell how to send back the selected option from the Select widget? (do I need a contract variable?)
Could you please tell me how to set a default selected option? (option selected in previous step)

Thanks for your help.

By the way, this is the actual json result I get from the Process variable:

{ "name": "listaDepartamentosSAP", "description": null, "transientData": false, "className": "java.util.List", "containerType": "PROCESS_INSTANCE", "tenantId": 0, "tenantId_string": "0", "id": 35011, "id_string": "35011", "containerId": 17005, "containerId_string": "17005", "value": [ [ "AA", "Aires Acondicionados" ], [ "AD", "Administrativo" ], [ "AP", "Aprovisionamiento" ], [ "AU", "Auditoria Interna" ], [ "CD", "Centro Datos" ], [ "CO", "Comercial" ], [ "DI", "Distribuciones" ], [ "DP", "Directores & Presidencia" ], [ "EL", "Electromecánicos" ], [ "FI", "Financiero & Aprov." ], [ "GE", "Gerencia" ], [ "GH", "Gestión Humana" ], [ "GN", "Generadores" ], [ "IN", "Ingeniería & Logistica" ], [ "IS", "Instalaciones" ], [ "LE", "Legal" ], [ "LO", "Logística" ], [ "MC", "Mantenimiento Correctivo" ], [ "ME", "Mercadeo" ], [ "MP", "Mantenimiento Preventivo" ], [ "NO", "NOC" ], [ "OP", "Operaciones" ], [ "PO", "Potencia" ], [ "PR", "Proyectos" ], [ "QE", "Calidad Energia" ], [ "SCE", "Servicio Cableado Estruct." ], [ "TI", "Tecnologías de Información" ] ], "value_string": "[[AA, Aires Acondicionados], [AD, Administrativo], [AP, Aprovisionamiento], [AU, Auditoria Interna], [CD, Centro Datos], [CO, Comercial], [DI, Distribuciones], [DP, Directores & Presidencia], [EL, Electromecánicos], [FI, Financiero & Aprov.], [GE, Gerencia], [GH, Gestión Humana], [GN, Generadores], [IN, Ingeniería & Logistica], [IS, Instalaciones], [LE, Legal], [LO, Logística], [MC, Mantenimiento Correctivo], [ME, Mercadeo], [MP, Mantenimiento Preventivo], [NO, NOC], [OP, Operaciones], [PO, Potencia], [PR, Proyectos], [QE, Calidad Energia], [SCE, Servicio Cableado Estruct.], [TI, Tecnologías de Información]]" }

1 answer

1
0
-1
This one is the BEST answer!

Hi There,

Your data should be in name value json format. See following example. Once you have got your data on this format you can assign "Available Values" as this list, Displayed Key as what you want to display in the dropdown eg "name" form the following example and "Returned Key" to the key of the name eg: "abbr".

Avaliable Values : result
Displayed Key : name
Returned Key : abbr

Please bind your contract valiable in Value.

EG:
"result" : [
{
"country" : "USA",
"name" : "Alaska",
"abbr" : "AK",
"area" : "1723337SKM",
"largest_city" : "Anchorage",
"capital" : "Juneau"
}, {
"country" : "USA",
"name" : "Arizona",
"abbr" : "AZ",
"area" : "294207SKM",
"capital" : "Phoenix"
}, {
"country" : "USA",
"name" : "Arkansas",
"abbr" : "AR",
"area" : "134770SKM",
"capital" : "Little Rock"
}
]

Cheers
Kiran

Comments

Submitted by mbolanos_1 on Wed, 12/07/2016 - 23:42

Thanks Kiran. I think I selected the wrong list format (columns) when setting the "connector in".
That's why I was getting this result: ["xxx","yyy"].

In order to get a result as you suggested, the format must return key and value.

Notifications