How to loop over CSV file and write each line in Write File activity?

1.1k Views Asked by At

I am using TIBCO BW 6.5 designer, I am trying to read a large CSV file (having ; as separator). Below are some of my sample CSV file data:-

ORDER_NUMBER;CODE_NUMBER
A;014 53758
B;015 73495
C;016 67569
D;017 59390

I am trying to start reading from 2nd line i.e. "A;014 53758". I am using "ParseData" activity which is placed inside a "Repeat" group as shown in Image below:- enter image description here

The configuration of my "Repeat" group is below:- enter image description here

The configuration of my "ParseData" is:- enter image description here enter image description here

In my WriteFile I have checked the "append" box, and I am writing as 'Text' in my file. The textContent for my WriteFile is :- concat($ParseData/Rows/Updates[$index]/ORDER_NUMBER, $ParseData/Rows/Updates[$index]/CODE_NUMBER , '&crlf;')

But when I run my project, the Write File only writes the first row and all the rest rows are blank.

Can anybody please help in rectifying what I am doing wrong.

Thanks, Rudra

1

There are 1 best solutions below

2
On

Try this :

  • ParseData activity input : startRecord should be 1 intead of $index + 1
  • WriteFile activity input : concat($ParseData/Rows/Updates[1]/ORDER_NUMBER, -$ParseData/Rows/Updates[1]/CODE_NUMBER, '&crlf;') (1 instead of $index)
  • You can uncheck the accumulate in the repeat loop