0
votes

I've created a flow that accepts a CSV via a form-data API POST and then processes each row in a batch job. Ideally, I do not want to hand-map each column before passing it to the batch executor, but I could not figure out how to just "pass through" the key/value pairs dynamically. I want to ensure that the CSV can have new columns and we'll pass them through without knowing about them beforehand... This is what I have:

%dw 1.0
%output application/java
---
payload map {
    title: $.title,
    description: $.description,
    template_id: $.template_id,
    pricing_flat_price: $.pricing_flat_price,
    scheduled_start_date: $.scheduled_start_date,
    resource_id: $.resource_id,
    industry_id: $.industry_id,
    owner_email: $.owner_email,
    location_offsite: $.location_offsite
}

And this is what I'm going for (in non-sensical psuedocode):

%dw 1.0
%output application/java
---
payload map {
    *:*
}

I have to imagine this is easily done, but I couldn't figure it out.

Thank you, Steve

2

2 Answers

0
votes

hand-map each column before passing it to the batch executor

You shouldn't need to do this. Pass the whole csv to the batch-input phase and allow it to split each line into a Linked Hashmap.

0
votes

You can simply use transformation like below -

%dw 1.0
%output application/java
---
(payload)