Author |
Message
|
sboucher |
Posted: Fri Oct 31, 2003 7:17 am Post subject: TDS REPEATING ELEMENT REPEATING ONLY ONCE (REWORKED) |
|
|
Acolyte
Joined: 27 Oct 2002 Posts: 52
|
I reworked my logical model as Jeff had suggested in a previous post under the same Subject but I am still having problems hopefully more simple this time.
LOGICAL MODEL
Simple Elements
Code STRING LEN6
Qty STRING LEN6
EOM STRING LEN1
Compund Types
REPEAT_DATA_TYPE containing
Code
Qty
REPEAT_GROUP_TYPE containing
REPEAT_DATA based on REPEAT_DATA_TYPE
EOM
Compond Elements
REPEAT_DATA based on REPEAT_DATA_TYPE
REPEAT_GROUP based on REPEAT_GROUP_TYPE
Message
REPEAT.MESSAGE based on REPEAT_GROUP_TYPE
Message Stream
111111555555888888999999:
I'm Looking for some comments on the Logical Model Design. What I need to have happen is as follows:
1. Have Code and Qty Repeat an unknown number of times.
2. Output in XML {CODE}{QTY}...{CODE}{QTY}
In my past attempts which failed, I focused on using data patterns in the TDS layer. Are there better/simpler methods.
Repeating Elements always begin in position 19 and end when a colon is reached.
Can I Insert a character in each message using ESQL in a compute node to act as a Group Indicator and use the colon as a group terminator to make this process work easier.
Thanks to all who have read this lengthy diatribe from a newbie and have given me your assistance. _________________ Scott A. Boucher
Database Administartor |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Oct 31, 2003 7:53 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Okay, this looks reasonably good.
What you'll do is set the repeating parameters on the REPEAT_DATA element inside REPEAT_GROUP. Then the parser should keep repeating the {CODE}{QTY} element sets until it finds EOM.
Yes, you could modify this to use use separators between each group using a Compute node to act on a BLOB message and then using a ResetContentDescriptor node.
Another option is to rely on the fact that your Code and Quantity elements are both exactly and only 6 characters long each. Then you can just set them as fixed length elements, with a length of 6. Then change the Data Element Separation on the TDS tab to Fixed Length.
The other thing is, you say your repeated elements start at position 19. You'll have to model in some way the stuff that comes before position 19. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
sboucher |
Posted: Fri Oct 31, 2003 10:13 am Post subject: |
|
|
Acolyte
Joined: 27 Oct 2002 Posts: 52
|
Jeff,
I like the idea of using fixed length but I still can only get the data to repeat once. Below are my properties for the Message Set:
REPEAT_GROUP_TYPE
Orderd Set Closed
TDS: Data Element Separation - Fixed Length
REPEAT_DATA
Connection: Repeat Yes; Min 1; Max 5
TDS: Nothing Set
CODE and QTY
Connection: Repeat No
TDS: Element Properties: Length 6
EOM
Connection: Repeat No
TDS: Element Properties: Length 1
MESSAGE FLOW COMPUTE NODE:
SET OutputRoot.XML."MSG"."REPEAT_DATA" = InputRoot.MRM."REPEAT_DATA";
SET OutputRoot.MQMD.Format = 'XML ';
MESSAGE OUTPUT
<MSG><REPEAT_DATA><CODE>111111</CODE><QTY>222222</QTY></REPEAT_DATA></MSG>
MESSAGE INPUT
111111222222333333444444:[/b] _________________ Scott A. Boucher
Database Administartor |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Oct 31, 2003 11:01 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
sboucher wrote: |
MESSAGE FLOW COMPUTE NODE:
SET OutputRoot.XML."MSG"."REPEAT_DATA" = InputRoot.MRM."REPEAT_DATA";
SET OutputRoot.MQMD.Format = 'XML ';
|
You're only telling it to copy the first REPEAT_DATA instance.
Change that to
Code: |
Set OutputRoot.XML."MSG"."REPEAT_DATA"[] = InputRoot.MRM."REPEAT_DATA"[] |
Or something similar.
Also, you don't need the extra spaces in 'XML ', unless you named your XML layer 'XML ' with the extra spaces. And you should, I believe, be setting OutputRoot.Properties.MessageFormat, not OutputRoot.MQMD.Format. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
sboucher |
Posted: Fri Oct 31, 2003 11:27 am Post subject: |
|
|
Acolyte
Joined: 27 Oct 2002 Posts: 52
|
Jeff, the flow works now and I'm getting output as expected. Thanks soooo much. I guess I'll have to have the <REPEAT_DATA></REPEAT_DATA> tags repeat throughtout the message
Here's my final output:
<MSG><REPEAT_DATA><CODE>111111</CODE><QTY>222222</QTY></REPEAT_DATA><REPEAT_DATA><CODE>555555</CODE><QTY>444444</QTY></REPEAT_DATA></MSG>
Thanks Again
Scott _________________ Scott A. Boucher
Database Administartor |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Oct 31, 2003 11:56 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
sboucher wrote: |
I guess I'll have to have the <REPEAT_DATA></REPEAT_DATA> tags repeat throughtout the message |
There are things you could do to get rid of it, but XML does not have any provisions for maintaining the order of sibling elements (as far as I know - there's probably stuff you can do with XSDs or something), so you would lose the relationship between a particular code and it's associated quantity. You'd get a list of CODE elements with no connection to any particular member of the list of QTY elements. That seems bad.
sboucher wrote: |
Thanks Again |
Don't thank me, thank Brandon. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
sboucher |
Posted: Fri Oct 31, 2003 12:13 pm Post subject: |
|
|
Acolyte
Joined: 27 Oct 2002 Posts: 52
|
Thanks Brandon !!! _________________ Scott A. Boucher
Database Administartor |
|
Back to top |
|
 |
|