Tag: DATAWEAVE
Mi carga útil es lang-json [ { "type": "Code", "method": "more", "Service": "Post", "Service_ID": "1" }, { "type": "Code", "method": "more", "Service": "Put", "Service_ID": "2" }, { "type": "Code", "method": "more", "Service": "get", "Service_ID": "3" } ] Código DataWeave para transformarlo en CSV con datastream: %dw 2.0 output application/csv header=true, . . . Read more
¿Cómo puedo cambiar el nombre de $ en la declaración else de un operador DataWeave match? Una forma es evitar else y usar un caso final siempre verdadero: payload match { case strPayload is String -> “Payload es una cadena: ” ++ strPayload case final if(true) -> final }
Desearía poder verificar si un archivo existe utilizando algunas funciones de Java dentro de un script de Dataweave 2.0: %dw 2.0 output application/dw import java!java::nio::file::Files::exists import java!java::nio::file::Paths::get — exists(get(“C:\Users\mhery\stackoverflow.csv”)) Pero recibo el siguiente error: ‘exists(get(“C:\Users\mhery\stackoverflow.csv”))’ tiene errores: No se puede resolver el módulo con el identificador java::nio::file::Files::exists. en 3 : . . . Read more
Tengo un script como este: %dw 2.0 output application/csv — payload.data map (item, index) -> { created_time: item.created_time as String {format: “yyyy-MM-dd”}, } Y el created_time es “2021-11-29T13:02:04+0000” y me gustaría cambiar la fecha a un formato diferente, pero la sintaxis no funciona. ¿Alguien puede ayudarme?
JSON de entrada: { “id”: “/”, “code”: “/”, “typeCode”: “CPC”, “timeStamp”: “2021-11-16T17:00:00-06:00”, “childList”: [ { “id”: “577-1-1”, “code”: “1111”, “name”: “Electronics-1-1”, “displayName”: “Electronics-1-1”, “active”: true, “languageCode”: “en”, “typeCode”: “CPC”, “childList”: [ { “id”: “579-2-1”, “code”: “2222”, “name”: “Calculators-2-1”, “displayName”: “Calculators-2-1”, “active”: true, “languageCode”: “en”, “typeCode”: “CPC”, “childList”: [] }, { . . . Read more