One Star

convert csv file rows to java map

I'm working on a medium to large size csv file. i want to transfer each row in the csv file to a java map. i have done some initiative, please see the attached job.
The problem is i'm unable to convert tMap's output table to direct java map. currently, i'm manually assigning each column to a java map (inside tJavaRow_1).
Is there any workaround for this?
appreciate your response.
3 REPLIES
One Star

Re: convert csv file rows to java map

I'm not entirely sure I understand correctly, but maybe tJavaFlex is a possible solution for you?
If not, please be more specific about your input schema and the details about your output object.
One Star

Re: convert csv file rows to java map

Hi rretzbach,
Thanks for your input. however, your solution doesn't fit for me. I'll detail my issue.
i have files in a folder. i have to convert each row in files to a java map for my processing. as you can see in previous diagram, i'm transferring row/column combination through tMap and then passing to tJavaRow. then the java code will convert to a map.
please see the attachments for more clarity.

as you can see i have to hardcode, "column name" to java map. this seems bit ugly for me. what i want is a simple solution as;

java.util.Map<String, String> newMap = (java.util.HashMap)tMap;

is it possible? or can you suggest me a better way to achieve this.
One Star

Re: convert csv file rows to java map

Hi,
I have managed to find a solution through browsing the forum. thanks you very much.
see my attached screen shots.