-1

i want to convert this csv input payload to text/plain but I got error.

Input payload :

timestamp;nnummer;ckundennummer;testname;name_gesamt;name_test_P0;name_test_P1;name_test_P2;name_test_P3;name_test_P4;name_test_P5;name_test_P6;name_test_P7;name_test_P8;name_test_P9;name_test_PD;name_test_PP;name_test_PSL;name_test_PZ;test_gesamt;test_test_P0;test_test_P1;test_test_P2;test_test_P3;test_test_P4;test_test_P5;test_test_P6;test_test_P7;test_test_P8;test_test_P9;test_test_PD;test_test_PP;test_test_PSL;test_test_PZ
2021-08-15;1889163;;EUR;0;0,0;0,0;0,0;0,0;0,0;0,0;0,0;0,0;0,0;0,0;0,0;0,0;0,0;0,0;57155;10,59;10,18;2,94;6,0;12,12;5,76;9,37;5,04;3,68;17,34;9,92;5,0;0,34;1,72

error message

aled
  • 21,330
  • 3
  • 27
  • 34
Lukica93
  • 1
  • 1
  • 1
    Please use text instead of images. See https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question for more details on the reason. – aled Oct 06 '21 at 21:33

1 Answers1

1

The error message is somewhat self explanatory. The input CSV is parsed by DataWeave into an array of objects representing the records. Output text/plain means to output a string. But it can not just convert an array to a string.

What you need to do is to write the payload as a CSV to a string, then output that. You can use the write() function for that:

%dw 2.0
output text/plain
---
write(payload, "application/csv")
aled
  • 21,330
  • 3
  • 27
  • 34