ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 87 - MCD - Level 1 discussion

Report
Export

What DataWeave expression transforms the example XML input to the CSV output?

A)

B)

C)

D)

A.
Option A
Answers
A.
Option A
B.
Option B
Answers
B.
Option B
C.
Option C
Answers
C.
Option C
D.
Option D
Answers
D.
Option D
Suggested answer: A

Explanation:

Correct answer is as below. Attributes in the incoming xml payload are always accessed using @.Similarly *item is required as we have multiple items in the request

%dw 2.0

output application/csv

---

payload.sale.*item map ((value, index) -> {

index: index,

sale: value.@saleId,

itemName: value.desc,

itemPrice: (value.quantity) * (value.price),

item: value.@itemId

} )

asked 18/09/2024
michiel van de belt
39 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first