Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Index for header 'filename' is 1 but CSVRecord only has 1 values error

avatar
Contributor

Hello. I am simply spliting a csv file into two based on their row values. and when I run it through the QueryRecord processor, I get the error below. What could be the possible fix for this? Sample csv is as follows 

 

GradeNm   ,CattleBreedNm   ,CattleGenderNm   ,Price
C++            ,beef_cattle          ,Female                  ,10094
C++            ,hanwoo               ,Female                  ,12001
C++            ,beef_cattle          ,Male                       ,12704
B++            ,milk_cow             ,Female                   ,16942
 
The error 
화면 캡처 2022-07-13 091701.png
1 ACCEPTED SOLUTION

avatar
Super Guru

@Lewis_King ,

 

This error means that some line(s) in your flowfile have less than 4 fields. Empty lines are typically ignored but if you have a trailing line, for example, with a space in it, that space will be interpreted as the first field (GradeNm) and the other fields will be missing, which could lead to this sort of problem.

 

Check your input file for trailing lines or lines with less than 3 commas in it.

 

If the problem is being caused by a blank line with spaces, for example, you could use the ReplaceText processor to remove those spaces, as shown below:

 

araujo_0-1657678374647.png

 

 

Cheers,

André

--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.

View solution in original post

2 REPLIES 2

avatar
Super Guru

@Lewis_King ,

 

This error means that some line(s) in your flowfile have less than 4 fields. Empty lines are typically ignored but if you have a trailing line, for example, with a space in it, that space will be interpreted as the first field (GradeNm) and the other fields will be missing, which could lead to this sort of problem.

 

Check your input file for trailing lines or lines with less than 3 commas in it.

 

If the problem is being caused by a blank line with spaces, for example, you could use the ReplaceText processor to remove those spaces, as shown below:

 

araujo_0-1657678374647.png

 

 

Cheers,

André

--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.

avatar
Contributor

Thank you so much for the help! this solved my problem