cancel
Showing results for 
Search instead for 
Did you mean: 

Read a CSV file from the Right to Left

philliperamos
Contributor

Good day community.
I have a CSV file, see attached, which I would like to pick up the last three fields from the right as their own fields, and the rest of the record/line as a “value” field.
sampleData.txt (80 Bytes)

So basically, the output should be
[value] [row] [pipeID] [date]
where is the remainder of the data in the row.

Is this possible?
Thanks

1 ACCEPTED SOLUTION

nsingam
Employee
Employee

Hi Philliperamos,

I created a pipeline that will keep the last 3 columns as it is and the rest of the row values will be concatenated under the value field. 

Here I am attaching pipeline and sample data file.
Hope this is what you are required.

Dynamic_csv_column_change_2019_11_14.slp (10.3 KB)
sample.txt (231 Bytes)

View solution in original post

5 REPLIES 5

nsingam
Employee
Employee

Hi Philliperamos,

I created a pipeline that will keep the last 3 columns as it is and the rest of the row values will be concatenated under the value field. 

Here I am attaching pipeline and sample data file.
Hope this is what you are required.

Dynamic_csv_column_change_2019_11_14.slp (10.3 KB)
sample.txt (231 Bytes)

@nsingam Thanks for this.
I forgot to mention that the number of columns can change.
So one file could have 10 columns, another file could have 7, but the last 3 columns would always be ROW, PIPEID and DATE.
Hence why I wanted to be able to read from right to left.

@philliperamos, I am not hardcoded anything in that pipeline. It will work for any no of columns in your CSV file. If for any reason the last 3 columns are different than ROW, PIPEID, DATE then those new columns will be keep as it is and these columns will come under value.

Ok great! Thanks!
I’ll test it with various files with different column amounts and let you know!