Author |
Message
|
vijsam |
Posted: Wed Jul 20, 2011 4:02 am Post subject: not able to handle extra comma using csv files |
|
|
Apprentice
Joined: 01 Jun 2011 Posts: 46
|
Hello Iam using WMB 6.1 on windows,i have
sample record:
1,2,3,4
5,6,7,8
i have set the following properties in the message set
Messaging Standard: CSV – Comma Separated Values
Data element separation settings:
Group Indicator:
Group Terminator:
Delimiter: ,
Suppress Absent Element Delimiters: Never
Distinguish tag and data values using:
Tag Data Separator:
Length of Tag:
Character data settings:
Default CCSID: 376
Fixed length strings:
Trim on input: No Trim
Truncate on output: Not checked
Quote character: “
Reserved Characters:,<CR><LF>”
when i use 3 commas it is parsing successfully.
even if i use 2 or 4 commas it is parsing successfully.
but it has to fail.
Please need your asistance.Thanks in advance. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jul 20, 2011 4:11 am Post subject: Re: not able to handle extra comma using csv files |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
vijsam wrote: |
when i use 3 commas it is parsing successfully.
even if i use 2 or 4 commas it is parsing successfully.
but it has to fail. |
I'm slightly confused (as is so often the case). It seems you've got a record with 4 comma delimited values, the record itself delimited with end of line. You have a business requirement for validation of the record to fail unless there are exactly 4 values (separated by 3 commas).
I don't see anything in your post that's trying to enforce that. It looks a lot like the standard message set you get when you tell WMB you're using a CSV (which can have any number of values obviously enough).
So what have you done to enforce this rule (if I have your situation correctly)? What happened when you tried it (error messages, shape of the parsed message in a user trace)?
Better information, better advice. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
vijsam |
Posted: Wed Jul 20, 2011 4:21 am Post subject: |
|
|
Apprentice
Joined: 01 Jun 2011 Posts: 46
|
I have added Min occurences and max occurences as per requirement In MDF,and in RCD node we set property of validate to ->content and value.So if there are 4 elements there should be 3 commas,so if the customer is sending more or less commas for the record it has to fail.Any help highly apricated...thanks once again. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jul 20, 2011 4:28 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
vijsam wrote: |
I have added Min occurences and max occurences as per requirement |
Where? To what element(s) of the message set? Where did you mention this in your original post??
vijsam wrote: |
In MDF,and in RCD node we set property of validate to ->content and value. |
What do you mean by MDF in this context?
vijsam wrote: |
Any help highly apricated |
What does a user trace show you about how the message is being parsed and the message tree built? Any clues there about what's happening to ignore / fail to apply these limits? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
vijsam |
Posted: Wed Jul 20, 2011 4:50 am Post subject: |
|
|
Apprentice
Joined: 01 Jun 2011 Posts: 46
|
sorry I mean MDF-->MessageDefination File.Our flow is FileNode-->Computenode-->RouteNode-->LableNode-->RCD node-->Compute node-->WTX map node-.It is passing succesefully and after RCD node it is failing in WTX map node.one or more input is invalid.
( WTX map failure).while debugging my i can see under MRM Messagetree structure it shows
a-->1
b-->2
c-->3
d-->,,
if i pass 1,2,3,,.
for the 4 th element i have enabled nillable property.
In The d value coming as ,, in the last field.
Last edited by vijsam on Wed Jul 20, 2011 5:27 am; edited 1 time in total |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jul 20, 2011 4:59 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
vijsam wrote: |
It is passing succesefully and after RCD node it is failing in WTX map node.one or more input is invalid.
( WTX map failure) |
Understand I don't know WTX from a hole in the ground, so I'll focus in the message up to that point
vijsam wrote: |
while debugging |
I didn't ask what you could see in the debugger - I asked what the user trace told you about the process of parsing and building. I'm not disputing that the message tree doesn't meet your needs (which is what the debugger is showing you); I'm asking what information is in the user trace about how it got like that.
vijsam wrote: |
for the 4 th element i have enabled nillable property. |
Why? If there have to be 4 values (with 3 commas) in this record why is the last one suddenly nillable? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jul 20, 2011 5:12 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
OK - so it looks as if TDS always creates the elements in the tree even if they are 'missing' from the input record. Otherwise your minOccurs=1 would have triggered a validation error, right?
You could value constraints ( MRM-speak for schema facets ) to the elements to disallow zero-length values. And if you wanted to, you could validate a lot more than just the length. |
|
Back to top |
|
 |
vijsam |
Posted: Wed Jul 20, 2011 5:33 am Post subject: |
|
|
Apprentice
Joined: 01 Jun 2011 Posts: 46
|
Hi kimbert,
[OK - so it looks as if TDS always creates the elements in the tree even if they are 'missing' from the input record.]...No kimbert i have mis spelled it.
The d value coming as ,, in the last field.sorry for that.
So my question is how can i explicitly throw error if there are more or less commas in the input file.Please need your assistance.
Thanks once again. |
|
Back to top |
|
 |
mattfarney |
Posted: Wed Jul 20, 2011 9:30 am Post subject: |
|
|
 Disciple
Joined: 17 Jan 2006 Posts: 167 Location: Ohio
|
Wouldn't it be easier to create a Compute Node that manually validates the format using ESQL, given that the format is so simple?
-mf |
|
Back to top |
|
 |
vijsam |
Posted: Wed Jul 20, 2011 10:54 pm Post subject: |
|
|
Apprentice
Joined: 01 Jun 2011 Posts: 46
|
I have just given a example here,we have arround 10 records which can be repeatative. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jul 21, 2011 4:44 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
vijsam wrote: |
So my question is how can i explicitly throw error if there are more or less commas in the input file.Please need your assistance. |
You use the suggestion of kimbert and disallow zero-length fields. And/or limit the number of fields.
Your problem is not that you have too many or too few commas in the input file. Your problem is that you have too many or too few fields....  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
WGerstma |
Posted: Thu Jul 21, 2011 6:57 am Post subject: |
|
|
Acolyte
Joined: 18 Jul 2011 Posts: 55
|
No idea what you really want to accomplish, but perhaps you can switch to a data pattern parsing where you exactly specify the input pattern of your line.
Perhaps something like
(.+\,){9}.+\r?\n
With 9 here representing the number of fields and commas you would need. At least with tinkering around you should be able to get a parsing exception when the input fails to match anything in your pattern. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jul 21, 2011 7:03 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
WGerstma wrote: |
No idea what you really want to accomplish, but perhaps you can switch to a data pattern parsing where you exactly specify the input pattern of your line. |
This might work.
Or you could use the inbuilt features of the product.
Depending on what fits best with the individual circumstances. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|