on 09-16-2009 8:06 AM
Hi,
I have the CSV file with comma(,) separator which has around 50 fields. Among them there were some description fields which has comma (ex: karan,kumar) which has to come as a single field and comes as 51 fields instead of 50.
Due to this, im facing problem at File content conversion and it is failing with error " ERROR converting document line no. 8534 according to structure 'Header':java.lang.Exception: ERROR in configuration / structure 'Header.': More elements in file csv structure than field names specified!
We have around 10 fields which comes in this way.Any idea how to solve this issue?
Thanks
Deepthi.
Hello Deepthi,
By any chance the "description" field is coming within any delimiter? If yes, then it's easy to handle.
For eg:- If the description field is "Kumar, Karan" with delimiter " ", then you can use xml.enclosureSign=" and xml.enclosureSignEsc=" " in your FCC.
If not, then you might have to change the FCC to FixedLength.
Just curious to know, how come this basic issue was not caught and the interface moved into Production?
Regards,
Neetesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this is really tough to handle. I dount if a solution exist unless you have another means of finding when a field would end. because Karan,Kumar is something that a program will never be able to distinguish as a single word.
Though its tough, I would suggest you to discuss the future problems and time wasted in troubleshooting, with your client and change the delimiter to an unusual signn like ~ or |.
VJ
>> If the description field is "Kumar, Karan" with delimiter " ", then you can use xml.enclosureSign=" and xml.enclosureSignEsc=" " in your FCC.
Thank you Neetesh. This solved my issue.
They are sending all the description fields in double quotes(" ") and enclosuresign helps in identifying and passing as a single entity.
Hi Deepthi,
You said for 10 fields you have this issue. If you always get for all this 10 fields if the value is present or not like karan,kumar as the example. If you dont have kumar then are you getting , instead of kumar. If yes then add 10 more fields in source datatype and concat in mapping.
If they dont come then your layout is itself wrong. Then as suraj suggested go with fixed length or and adapter module should work for you. Even if it is in produciton to over come this issue you may need to change in development itself for fixed length or ask the soure file gusy not to put comma for karan and kumar.
Regards,
---Satish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Deepthi,
The option here is use fieldFixedLengths instead of fieldSeparator. By this way evethough you have more fields in file than given filednames, it will not trigger any error. (But this one will still keep the commas which you might not need in the xml structure, though you can replace these in mapping anyway this is one solution )
enclosureSign option you can try, but you need do include the delimeter in you file structure, which is again a troublesum.
eg:- field1, | karan,kumar|,fieldn
In case you are familier with Adapter Module you can do it easily, but its a final option as far i am concern.
Regards,
Prasanna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Unfortunately this is difficult to handle. Can't you go for some other field separators like ';'
Regards
Suraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Suraj,
Thank you for your response.
Even If I go with ';' Iam not sure whether the descriptions won't come with ';' value. Again I will be with the same problem.
Is there any way atleast to ignore those records? That will solve my requirement temporarly.
Whenever I find that more fileds were present in the file then I have to ignore those particular records and I have to continue processing with the remaining records.. Is it possible to do this?
Thanks
Deepthi
Hi Deepthi,
>>This interface is already in production and we can't afford such a big change now.
oops!!
But if you know that the field length are fixed then this will not impact your XML structure. But can you say that the name field will always be say 25 characters long!!! I doubt.
another Alternative will be to use the enclosure sign as suggested above. But again you need to ask client to send files like that.
Third approach is to use some other separator which will never come in middle like ~ etc. But again client need to be convinced.
Sorry this is the maximum available options
Regards
Suraj
User | Count |
---|---|
84 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.