0

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 Answers 2

0

You can simply use transformation like below -

%dw 1.0
%output application/java
---
(payload)
Sign up to request clarification or add additional context in comments.

Comments

0

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.

1 Comment

This did not work for me. Error indicated the input class was not the right type.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.