Author |
Message
|
sboucher |
Posted: Wed Oct 29, 2003 9:02 am Post subject: TDS Repeating Element Only Repeating Once |
|
|
Acolyte
Joined: 27 Oct 2002 Posts: 52
|
I have defined the following logical model with a TDS physical layer that parses based on pattern matching but repeating elements only happen once
LOGICAL MODEL
CODE LENGTH 6 STRING
QTY LENGTH 6 STRING
TDS PHYSICAL LAYER
CODE Repeating Min Occurs 1; Max Occurs Left Blank (Unknown)
Pattern: [0-9]{6}
QTY Repeating Min Occurs 1; Max Occurs Left Blank (Unknown)
Pattern: [0-9]{6}
MESSAGE STREAM
123456000058654321000009:
Note: The colon signifies the end of message and will be part of
the message. My thoughts were the colon can signify the
end of repeating elements
MESSAGE FLOW PROPERTIES
Input Node Domain is set to MRM
I use a compute node to convert to XML as follows.
SET OutputRoot.XML."MSG"."CODE" = InputRoot.MRM."CODE";
SET OutputRoot.XML."MSG"."QTY" = InputRoot.MRM."QTY";
SET OutputRoot.MQMD.Format = 'XML ';
I'm stumped and looking for some assistance
Thanks _________________ Scott A. Boucher
Database Administartor |
|
Back to top |
|
 |
Yuvaraj |
Posted: Wed Oct 29, 2003 9:27 am Post subject: |
|
|
Apprentice
Joined: 28 Oct 2003 Posts: 30
|
Hi
Could you also tell whats the output you are getting?
In the case of repeating elements with unknown Max occurs, there must be a breaking condition for the parser to know that the repetition for this field as end and the next field is starting. Though your message has the ':', it just indicates the end of the message and not for the field/element level.
As per the data pattern you have given i.e. [0-9]{6}, the parser will be getting 6 bytes of input data and map onto the first field. Since this field is repeating, the parser will continute to pick the next field and map on to the same field and so on. Until it comes across the breaking condition indicating to the parser that this field has come to an end. Which doesn't seem to happen as per your data pattern and the message.
I think if you can give the output you are getting, it will be more helpful.
Thanks & Regards
Yuvaraj |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Oct 29, 2003 10:03 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
What Yuvaraj said is correct. There's no way with your current model for the parser to know when to stop taking CODE elements and start taking QTY elements. You are telling the parser that your data looks like {CODE}{CODE}....{QTY}{QTY}..... So it needs to know (by a delimiter) when to stop grabbing CODE elements and switch to grabbing QTY elements.
If your data is actually {CODE}{QTY}{CODE}{QTY}.... instead of {CODE}{CODE}....{QTY}{QTY}.... then that is a different logical structure, and can be handled without adding any additional delimiters.
For that you need to create an enclosing Compound type that is a Fixed Lenght type that contains the CODE and QTY elements. Then create an element of that fixed type in your Message, and set the unknown maximum repeat on the compound element, with the terminating : modeled. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
sboucher |
Posted: Wed Oct 29, 2003 12:41 pm Post subject: |
|
|
Acolyte
Joined: 27 Oct 2002 Posts: 52
|
Jeff,
I want to model {Code}{Qty}{Code}{Qty} as you have suggested in your reply.
Can you please take me through the logical modeling and bear with me as this is all new to me and no training in sight:
This is what I did after reading your post (Starting from scratch) to create the new logical model:
1. Created New Message Set
2. Righ Clicked Type..Use Smart Guide to Create Compund Type
3. Named Type REPEAT_T
4. Created elements with smart guide:CODE Len 6 QTY Len6
5. Set Repeating to Yes Min Occurs 1; Max Occurs Blank for both
CODE and QTY
6 Type Composition: Ordered Set; Type Content Closed
7. Created Message based on Type REPEAT_T
I'm unsure whether I created the compund type correctly. You mentioned to create a Fixed Length Type. Didn't see where there was a choice for this or might this be part of the TDS Physical layer. Also will I still be doing pattern matching with the Group Terminator set to :
Thanks so much for your reply. I really would approciate someone walking me through this
Thanks _________________ Scott A. Boucher
Database Administartor |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Oct 29, 2003 12:49 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
What you want is a message tree like this:
You will set the Repeat only on the Group element above, not on the individual code and quantity elements. This is because what you've got is exactly a repeating group of elements, not a group of repeating elements.
If you're using data patterns, which you are, then you can ignore what I said about fixed length (and I should have ignored it myself) and terminators. Use the patterns to indicate the size and type and the terminator and etc of your elements as you already are.
Basically, just take what you've got, add a Group (or whatever you want to call it) compound type and element, and then change where the repeats are specified. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
sboucher |
Posted: Wed Oct 29, 2003 3:43 pm Post subject: |
|
|
Acolyte
Joined: 27 Oct 2002 Posts: 52
|
Jeff,
Didn't I create a group when I used the smart guide for creating REPEAT_T.
I only see the connection tab on the individual elements (CODE QTY) within REPEAT_T and not on REPEAT_T itself.
Can you be very specific, this is soooo frustrating for me.
Thanks _________________ Scott A. Boucher
Database Administartor |
|
Back to top |
|
 |
|