|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
CSV to TDS |
« View previous topic :: View next topic » |
Author |
Message
|
frikkieo |
Posted: Fri Jul 16, 2004 5:00 am Post subject: CSV to TDS |
|
|
Novice
Joined: 16 Jul 2004 Posts: 13 Location: South Africa
|
I am currently trying to set up a tds message set to read a csv message.
The problem I am having is that the character value fields are put in double quotes.
Within the quotes as part of the field value there might be commas as well.
Ie.
"Value of String 1",1234,"Value of String 2",56789
"Value, String 1",123,"Value, String 2",890
Have anyone seen anything like this? How can it be parsed correctly?
We are using WMQI 2.1 CSD 07 on Windows 2000.
Regards
Frikkie |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Jul 16, 2004 7:11 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You should be able to define your CHARACTER fields to be Tagged with " and delimited with ", and define the group that holds your character fields to be delimited with ','.
Or you could use Data Patterns and model with with a regular expression. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
shanson |
Posted: Mon Jul 19, 2004 1:53 am Post subject: |
|
|
 Partisan
Joined: 17 Oct 2003 Posts: 344 Location: IBM Hursley
|
I'd try the Use Data Pattern approach and see how it performs.
It's a little fiddly to set up but essentially your Data Pattern needs to look for either a leading double-quote and a trailing double-quote, or no quotes, something like (("([^"])*")|([^,])*)*. I've not tried this out, so it might not be 100% correct. |
|
Back to top |
|
 |
wooda |
Posted: Wed Jul 21, 2004 3:43 am Post subject: |
|
|
 Master
Joined: 21 Nov 2003 Posts: 265 Location: UK
|
Ditto what shanson said, data pattern ought to work for this.
I had to model something very similar and suceeded using a separation of data pattern to separate the elements (using patterns very like the one shanson mentioned) and some trickery with group indicators and choice inside each element to remove the unwanted commas and quotes.
Seemed to work ok.
Q. Can the fields in your CSV message also contain double quotes in the data ?
Q. Can you predict which elements will be double quoted and which not ? (If you can't then this is where a choice may be necessary in each element)
regards,
- Alex |
|
Back to top |
|
 |
dino |
Posted: Sun Sep 26, 2004 7:02 am Post subject: |
|
|
Newbie
Joined: 26 Sep 2004 Posts: 6
|
Hi,
I am trying to model a similiar csv format as this...
Code: |
"Value of String 1",1234,"Value of String 2",56789
"Value, String 1",123,"Value, String 2",890 |
1. A character field will be enclosed by double quote.
2. A character field can contains comma , within the double quote but it is not a delimiter character.
3. A decimal/ integer field will NOT be enclosed by double quote.
4. All character, decimal and integer fields are delimited by comma ,
I have tried the above suggestion. However, when i add a comma into a character field (ie "This string should, be in 1 field"), the data gets truncated because the comma is taken as delimiter character.
To keep it simple, the character field does not contains double quotes. However, is it possible to model TDS such that a character field can contains double quote too?? (ie "This string should, " be in 1 field")
I am using WBIMBv5 CSD3. Hope to hear from u guys. Thanks in advance!!!  |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|