cancel
Showing results for 
Search instead for 
Did you mean: 

Message Mapping

Former Member
0 Kudos

Hi All,

I am having 4 messages as source and one message as target.

I have taken a screenshot of the source file format and the target file format and uploaded it.

Please go through this link...

<a href="http://www.MegaShare.com/images/images/1254851279/Mapping.JPG">Message Mapping Image</a>

If you go through the image you will find different colors, they are just to show that values from the same colors are clubbed together in the final output file.

If you need any additional information please letme know.

Thanks in advance..

Sumit

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

How does it look in graphical message mapping.

do you have:

<messages>

<message1> occurency unbounded

</message1>

</messages>

or

<messages>

<message1> occurency unbounded

</message1>

<message2> occurency unbounded

</message2>

<message3> occurency unbounded

</message3>

<message4> occurency unbounded

</message4>

</messages>

if the first one please just remove context (or use upper) and map it directly if second one you probably will have to use if exist and check inside each messages

regards,

wojtek

Former Member
0 Kudos

Hi,

thanks,

i will try to explain the problem again..

I am getting details about a productcode(p1,p2,...) in different rows, but finally i need to map all the details in one row.

If you have a look at the XML message maybe u can understand a lil bit ...

Here is the source message xml ..

<?xml version="1.0" encoding="UTF-8" ?>

<i>- <ns0:MT_SALETARGET_REQ_response xmlns:ns0="urn:spares.com">

- <STATEMENT_response>

- <row>

<YEARMONTH>200609</YEARMONTH>

<PRODUCTCODE>P1</PRODUCTCODE>

<SALESQTY>10</SALESQTY>

<SALESVALUE>20</SALESVALUE>

<TOTALFOREQTY />

</row>

- <row>

<YEARMONTH>200609</YEARMONTH>

<PRODUCTCODE>P2</PRODUCTCODE>

<SALESQTY />

<SALESVALUE />

<TOTALFOREQTY>600</TOTALFOREQTY>

</row>

</STATEMENT_response>

- <STATEMENT_response>

- <row>

<YEARMONTH>200609</YEARMONTH>

<PRODUCTCODE>P2</PRODUCTCODE>

<SALESQTY />

<SALESVALUE>50</SALESVALUE>

<TOTALFOREQTY />

</row>

- <row>

<YEARMONTH>200609</YEARMONTH>

<PRODUCTCODE>P1</PRODUCTCODE>

<SALESQTY />

<SALESVALUE />

<TOTALFOREQTY>600</TOTALFOREQTY>

</row>

</STATEMENT_response>

</ns0:MT_SALETARGET_REQ_response></i>

Target Message..ie i want the output in this format.

<i><?xml version="1.0" encoding="UTF-8"?>

<ns0:MT_FILE_IN xmlns:ns0="urn:spares.com">

<RESPONSE>

<row>

<YEARMONTH>200609</YEARMONTH>

<PRODUCTCODE>P1</PRODUCTCODE>

<SALESQTY>10</SALESQTY>

<SALESVALUE>20</SALESVALUE>

<TOTALFOREQTY>600</TOTALFOREQTY>

</row>

<row>

<YEARMONTH>200609</YEARMONTH>

<PRODUCTCODE>P2</PRODUCTCODE>

<SALESQTY />

<SALESVALUE>50</SALESVALUE>

<TOTALFOREQTY>600</TOTALFOREQTY>

</row>

</RESPONSE>

</ns0:MT_FILE_IN></i>

Regards,

Sumit

Message was edited by: Sumit Khetawat

Former Member
0 Kudos

Hi,

Ok now I understand it. You would like to group all this by product code. So what to do? Map product code to product code without repetition. For all the rest which is agregated create User defined functions which will use HashMap in GlobaContainer. You can find such examples here on SDN.

regards,

wojtek

Former Member
0 Kudos

hi Sumit,

seems a little bit difficult.

Easiest thing to do is 3 message mappings via BPM

1 + 2 --> A

A + 3 --> B

B + 4 --> C

In each mapping you compare each cell with the corresponding cell (eg. P1 Message 1 vs P2 Message 2) and write the higher number to the target field.

If you cant use BPM and you need one message I would use a User Defined Function. This UDF has 4 Input parameters. The output parameter is the highest number of correxponding 4 cells.

Regards Mario

Former Member
0 Kudos

Hi Mario,

Thanks ...

Right now i have shown one source message,

actually i have 4 source messages and data related to a particular product code maybe there in all 4 of the source message or maybe in 3 or maybe 2.

If you have alook at the mapping link i gave in the first image you will be able to understand.

Regards,

Sumit

Former Member
0 Kudos

Hi sumit,

I am sure I unterstood your problem.

Do make it more than sure:

- do you ever expect 4 source messages?

If yes, have a deeper look at my answer:

A sample. We only look at Cell P1/Actual Volume

First Mapping: 1 + 2 --> A

FirstInputFile = 100

SecondInputFile = 0

100 is bigger than 0, so 100 is mapped to target-message A = 100

Second Mapping A + 3 = B

A = 100

ThirdInputFile = 0

100 is bigger than 0, so 100 is mapped to target-message B = 100

Third Mapping B + 4 --> C

FourthInputFile = 0

100 is bigger than 0, so 100 is mapped to target-message C = 100

Does this help?

Regards Mario

Former Member
0 Kudos

Hi,

If you wish to do this using user-functions, here is a proposal. Create 2 user-functions:

GetUnique:

Vector v = new Vector();

for (int i=0; i<a.length; i++) {

if (!v.contains(a<i>))

v.add(a<i>);

}

for (int i=0; i<v.size(); i++) {

result.addValue((String)v.get(i));

}

SumValue: (this is assuming your are summing up the values with matching PRODUCTCODE)

Integer val = new Integer(0);

Vector v = new Vector();

Map total = new HashMap();

for (int i=0; i<a.length; i++) {

if (!v.contains(a<i>)) {

v.add(a<i>);

total.put(a<i>, val);

}

}

for (int i=0; i<a.length; i++) {

if (b<i>.equals("")) b<i> = "0";

Integer k1 = (Integer) total.get(a<i>);

int k = k1.intValue() + Integer.parseInt(b<i>);

k1 = new Integer(k);

total.put(a<i>, k1);

}

for (int i=0; i<v.size(); i++) {

Integer k1 = (Integer) total.get(v.get(i));

String s = "";

if (k1.intValue() != 0) s = k1.toString();

result.addValue(s);

}

=======================================

Then map the following:

PRODUCTCODE -> GetUnique -> row

PRODUCTCODE -> GetUnique -> SplitByValue -> PRODUCTCODE

PRODUCTCODE ->

SALESQTY -> SumValue -> SplitByValue -> SALESQTY

PRODUCTCODE ->

SALESVALUE -> SumValue -> SplitByValue -> SALESVALUE

PRODUCTCODE ->

TOTALFOREQTY -> SumValue -> SplitByValue -> TOTALFOREQTY

Also, make sure, for all the source elements, the context is set to the root level.

Regards,

Bill

Former Member
0 Kudos

Hi Mario,

That is not what i am looking at. See for a particular product code i am getting values(like Actual,Target,Forecast) from different systems.So finally i need to map them together.

Regards,

Sumit