|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
Repeating fields from Excel |
« View previous topic :: View next topic » |
Author |
Message
|
jefflowrey |
Posted: Fri Apr 16, 2004 5:18 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
IamSam wrote: |
Shall i tell what the problem is
MRM doesn't support optional elements |
That's simply not true.
MRM does support optional elements.
It does not support having the LAST element in a record be optional.
That's really not the same thing at all.
And you could probably finesse this by modeling your record terminator as an element rather than a terminator. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
dkeister |
Posted: Sun Apr 18, 2004 4:27 am Post subject: |
|
|
Disciple
Joined: 25 Mar 2002 Posts: 184 Location: Purchase, New York
|
Jeff, thanks for the clarification. I do know the MRM does support optional elements. If there is only one row, each element can be optional.
What I was trying to configure is a repeating row so I didn't have break the input message into individual rows and still have the benefit of the parser breaking the message into individual fields.
My real case has quite a number of fields and the EOL is really <LF> (I'm running on UNIX) and I have not figured a way to model this using the record terminator as an element.
I don't know if it can be done, but any suggestions would be great.
Thanks for your comments. |
|
Back to top |
|
 |
jefflowrey |
Posted: Sun Apr 18, 2004 5:49 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
What I'm suggesting is that you add an additional field to your ROW_T type, that will be a single character field that will hold the <LF>. But there are problems with that, including how the parser knows when one ROW_T stops and the next begins. (It might work if you were using <CR><LF>, because then you could model the <CR> and use the <LF> as the delimiter...).
Let's look at your sample message
dkeister wrote: |
I have defined a message
ROWS_M a message with ROWS_T type
- ROWS_T is all elements delimited <CR><LF> and contains
. - ROW element of type ROW_T with repeat Y and rep-del <CR><LF>
. - ROW_T is all elements delimited <HT> and contains
. - COL1 and
. - COL2 |
So what you've got is a message that contains a single element. That single element is a repeating element, and contains your row fields.
One initial problem is that your data doesn't exactly match your model. Your model says that ALL the elements in ROW_T will be delimited with <HT>, and that's not quite true. All of them are delimitied EXCEPT your last one.
However, last I knew (and this might be fixed in v5 - I should test it sometime), even if you have a terminating delimiter, the MRM doesn't like it when the last element is optional and missing.
If I get a chance, I will do some playing around to see if I can get something to work with v5.
But it should definately work if you can add an extra column field that will always be there - even in 2.1. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
dkeister |
Posted: Sun Apr 18, 2004 5:53 pm Post subject: |
|
|
Disciple
Joined: 25 Mar 2002 Posts: 184 Location: Purchase, New York
|
Jeff, thanks for taking the time.
It works if there is only one row. The fact that it is repeating seems to be where the problem lies. I assume it is with the optional field that is missing as you say.
I've got a work around so maybe I'll check with folks from the lab at the tech conference. |
|
Back to top |
|
 |
fjcarretero |
Posted: Mon Apr 19, 2004 8:09 am Post subject: |
|
|
Voyager
Joined: 13 Oct 2003 Posts: 88
|
Sorry,
I was talking about v5
I have read the documentation "Working with messages update" and the only way WMQI v2.1 wouldn't supress delimiters for missing elements, is that the delimiter for the element and the parent element are the same.
Cheers
Felipe |
|
Back to top |
|
 |
rajaram |
Posted: Tue Apr 20, 2004 8:51 am Post subject: |
|
|
Acolyte
Joined: 02 Jan 2004 Posts: 53
|
Hi,
U will definitely get a solution using Choice type and the Date Element Seperation property to DATA PATTERN.
I am pretty confident about that. I have tried with two columns A and B and it works very fine.
create Main Record MREC. Group Terminator <CR><LF>/<LF> which ever u want to use, ALL ELEMENTS DELIMETED BY
<CR><LF>/<LF> which ever u u want to use.
Create a compound type (CHC_TYP) of type composition choice. set the DATA ELEMENT SEPARATION property to DATA
PATTERN.
Now, Create an element(CHC_ELEM) of type CHC_TYPE Under MREC and set the DATA ELEMENT SEPERATION
to DATA PATTERN. Set the repeat property to yes and repeating element delimeter property to cr,lf/lf which
ever u u want to use.
Now, Under this CHC_ELEM,
create 3 compound types.
1st compoundtype: A_TAB_B (THIS IS SELECTED IF BOTH A AND B ARE
---------------------
PRESENT I.E, IF BOTH OF HAVE ATLEAST ONE CHARACTER)
type composition: sequence
type content : closed
data pattern: [^\t]+\t[^\r]+
data element Seperation: all elements delimeted
delimeter: <HT>
Now, under the first compound type,
create THE FOLLOWING TWO elements
ELEMENT: A
ELEMENT:B
2ND compoundtype: TAB_B (THIS IS SELECTED IF A IS NOT PRESENT
----------------------
AND B IS PRESENT I.E, B HAS ATLEAST ONE CHARACTER AND A DOESNT HAVE ANY CHARACTER IN IT)
type composition: sequence
type content : closed
GROUP TERMINATOR :
GROUP INDICATOR : HT
data pattern: \t[^\r]+
data element Seperation: all elements delimeted
delimeter: <HT>
under second compound type, CREATE ONLY ONE ELEMENT
ELEMENT:B
3RD compoundtype: A_TAB (THIS IS SELECTED IF B IS NOT PRESENT
----------------------
AND A IS PRESENT I.E, A HAS ATLEAST ONE CHARACTER AND B DOESNT HAVE ANY CHARACTER IN IT)
type composition: sequence
type content : closed
GROUP TERMINATOR : HT
GROUP INDICATOR :
data pattern: [^\t]+\t
data element Seperation: all elements delimeted
delimeter: <HT>
under third compound type,
CREATE ONLY ONE ELEMENT
ELEMENT:A
I am assuming that ATLEAST one of A OR B WILL BE PRESENT..
plz...LET ME KNOW IF THIS IS NOT THE CASE...
the final structure of input message looks like:
MREC-->CHC_ELE-->
CHC_ELE CONTAINS 3 COMPOUND TYPES ...A_TAB_B, TAB_B, A_TAB
Plz..do not hesitate to ask if u need more info..
thanks,
raja |
|
Back to top |
|
 |
rajaram |
Posted: Tue Apr 20, 2004 8:57 am Post subject: |
|
|
Acolyte
Joined: 02 Jan 2004 Posts: 53
|
Code: |
Now, Create an element(CHC_ELEM) of type CHC_TYPE Under MREC and set the DATA ELEMENT SEPERATION
to DATA PATTERN. Set the repeat property to yes and repeating element delimeter property to cr,lf/lf which
ever u u want to use.
|
Sorry, There is no data element separation property for CHC_ELEM, Plz..ignore the data element separation property for this..rest everything is fine..
Thanks,
raja |
|
Back to top |
|
 |
dkeister |
Posted: Wed Apr 21, 2004 5:38 am Post subject: |
|
|
Disciple
Joined: 25 Mar 2002 Posts: 184 Location: Purchase, New York
|
rajaam, I've not used PATTERN before so this wil take some time as I am in the middle of a problem with my InputNode which reads files from folders. It is blowing memory on AIX system (works OK on Windows) and this is a critical situation.
It will probably be a couple of days before I get to try out your suggestions.
Dean |
|
Back to top |
|
 |
|
|
|
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
|
|
|
|