cancel
Showing results for 
Search instead for 
Did you mean: 

Message Mapping Design Question

Former Member
0 Kudos

I have to parse from a source field (x) and map to this structure:

<Line>

<Number\>

<Descr\>

<Code\>

</Line>

The source field is a string that contains newline characters (just a blob of text). Example:

ABC\nLine 1,widget, 123A\nXYZ\nLine 2,gadget,123B

I need to get at the line number, description, and code mapping values by parsing at newlines and then parse into the "Line" records. I want my result to look like this:

<Line>

<Number>1</Number>

<Descr>widget</Descr>

<Code>123A</Code>

</Line>

<Line>

<Number>2</Number>

<Descr>gadget</Descr>

<Code>123B</Code>

</Line>

Is there a way to chain message mapping functions and/or UDFs and do something like this? In addition, I don't see how I can specify multiple target fields in one mapping. Any suggestions would be appreciated. Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

justin_santhanam
Active Contributor
0 Kudos

Keith,

We can do it using UDF. But Can u give us the exact source structure and which value corresponds to which field. It will be more helpful to suggest and proceed further.

Best regards,

raj.

Former Member
0 Kudos

Raj,

Unfortunately, the source structure is not well structured. It contains lines of data, of which some begin with "Line", and then a line number and other fields separated by commas. It also contains unused lines.

Production example of source data (with breaks at each newline character):

APPROVED

Tracking Reference: 20070629063604.1

Process Date: 06-29-2007 07:38:59

Listed below are the following items listed for review:

Contract: ABC Delivery Order Number: HTCH

Items reviewed:

Line 1, 10 EA, 000000000099784711, S01-004, 20070629063604.1_1

Line 2, 10 EA, 000000000088078625, 03356.63.04, 20070629063604.1_2

..where "1" maps to <Number>, "S01-004" maps to <Descr> and "20070629063604.1_1" maps to <Code>.

justin_santhanam
Active Contributor
0 Kudos

Keith,

Its fine we can do it. Please confirm me wht is the separator between each field is it /n or , .Also we will have only 5 columns in each row am I right?

Best regards,

raj.

Former Member
0 Kudos

A comma separates each field in a row beginning with "Line". There is a /n separating each row of data. Yes, 5 columns in each row beginning with "Line".

justin_santhanam
Active Contributor
0 Kudos

Keith,

Did u solved the issue? I'm not getting through it, since I'm not sure how ur input data will be, even though u gave two sample data above. If you haven't solved the issue, could you please give me the exact structure of the input data.

I want to know whetehr the data will be below format

<Test>Line 1, B67,B78,B88\nLine2,C67,C78,C88\nLine3,D67,D78,D88</Test>

or

<Test>Line 1, B67,B78,B88

Line2,C67,C78,C88

Line3,D67,D78,D88

</Test>

Please conirm it.

Best regards,

raj.

Former Member
0 Kudos

<Test>Line 1, B67,B78,B88

Line2,C67,C78,C88

Line3,D67,D78,D88

</Test>

I was mentioning the "\n" because the above really contains a newline between each line of data. I assume I will have to split on the newline and then on the comma.

Answers (2)

Answers (2)

Former Member
0 Kudos

I have this working. Thanks everyone.

What really helped was the blog entitled "Mapping Context Changes in XI" that I found on SDN.

henrique_pinto
Active Contributor
0 Kudos

Then please close thread.

Regards,

Henrique.

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

you can use a UDF (type queue) that will export all the values to your XML target

inside this UDF just parse the string

you also need to put the rest of the values into global variable

and retrive them from two other UDFs

but it's pretty easy

Regards,

michal

-


<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

Former Member
0 Kudos

Michal,

Can you point me towards an example or instructions on queue type UDFs?