cancel
Showing results for 
Search instead for 
Did you mean: 

Message Mapping HELP!!!!

Former Member
0 Kudos
70

hi people.i am currently studying xi and my mentor has left me an assignment of which im struggling to map. could someone be good enough to post a snap shot example of how i would map the senario and where i would use the udf. the senario is as follows:........................................This is an interface between HNS and Camelot. HNS are a service provider to Camelot. HNS carry out all of the installations of Comms Equipment throughout the country.

The purpose of this interface is for HNS to send updates back to camelot on the status of the work that they have been requested to carry out.

A file will be picked up that contains many items, however some of these items are identicle items and only the Action and Quantity's are different. In this case the Target file should contain only One occurence of an ItemNumber but the subnode for Actions should contain all of the Action and Quantity Items for that particular ItemNumber.

The file is to be picked up from HNS and sent to TWO of Camelots systems (Camelot_CRM & Camelot_ECC). Both of Camelots systems use the same message structure and hence the message mappings are also the same.

Below is a sample of the type of file that HNS will drop off.

<Source>

<Details>

<ItemNumber>01<ItemNumber>

<StartDate>20080410<StartDate>

<EndDate>20080420<EndDate>

<Action>Complete<Action>

<Quantity>1<Quantity>

</Details>

<Details>

<ItemNumber>01<ItemNumber>

<StartDate>20080410<StartDate>

<EndDate>20080420<EndDate>

<Action>InProcess<Action>

<Quantity>2<Quantity>

</Details>

<Details>

<ItemNumber>01<ItemNumber>

<StartDate>20080410<StartDate>

<EndDate>20080420<EndDate>

<Action>Cancelled<Action>

<Quantity>1<Quantity>

</Details>

<Details>

<ItemNumber>02<ItemNumber>

<StartDate>20080310<StartDate>

<EndDate>20080320<EndDate>

<Action>Complete<Action>

<Quantity>1<Quantity>

</Details>

<Details>

<ItemNumber>02<ItemNumber>

<StartDate>20080310<StartDate>

<EndDate>20080320<EndDate>

<Action>Problem<Action>

<Quantity>5<Quantity>

</Details>

</Source>

Quick Hints:

You will need to play with the contexts...

You will need to use the node function "formatbyexample"

You will need to use the below UDF:

ArrayList al = new ArrayList(Arrays.asList(a));

int count = 0;

Object object = null;

Object objectAux = null;

ArrayList ret = null;

ret = new ArrayList();

if ((al != null) && (al.size() > 0))

{

object = (Object) al.get(count);

objectAux = (Object) al.get(count);

ret.add(object);

count++;

while (count < al.size())

{

object = (Object) al.get(count);

if (!object.equals(objectAux))

{

ret.add(object);

objectAux = object;

}

count++;

}

}

String str[] = (String[]) ret.toArray(new String[ret.size()]);

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

String r = str<i>;

result.addValue(r);

}

Edited by: andy coip on Sep 21, 2008 2:31 PM

Edited by: andy coip on Sep 21, 2008 2:32 PM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Well, you'll need a table for Actions and Quantity for each item number instead of the flat structure now. You need contexts for this, because you will need a list of all actions - and xi gives you a queue of all actions (an array, to be precise) if you consider the actions at source level, not a details level. Put it ina mapping, right click on Actions, for example, change context to Source and then have a look at the queue (again right click on it). Maybe you'll see it more clearly then.

Former Member
0 Kudos

Hi,

Can you please describe of what will be the desired structure of your output for the example you mentioned above?

Regards,

Lex

Former Member
0 Kudos

the target structure is another thing im having trouble figuring out as this is all the info i have been given

Former Member
0 Kudos

ive have been informed tthat i have to create my own target structure from the given info. If anyone can give me an example or even any hints or tips i would be most gratefull

thanks

Edited by: andy coip on Sep 22, 2008 6:21 PM

Former Member
0 Kudos

can anyone offer me any advice at all.please please please!!!!!!!!!!!!