cancel
Showing results for 
Search instead for 
Did you mean: 

Container object in Message Mapping

Former Member
0 Kudos

Hello

I am having a scenario where I want to reuse the previous value of a map to calculate another value.For the same I tried container parameters in Message Mappings by using a simple Java function calling

container.getGlobalContainer().setParameter("test","value");

in another simple user defined java method I used container.getGlobalContainer().getParameter("test").

But my target value is coming as null.

Anybody knows how to use container methods to reuse values in Message Mappings??

Thanks in advance.

Regards

Rajeev

Accepted Solutions (1)

Accepted Solutions (1)

MichalKrawczyk
Active Contributor
0 Kudos

Hi Rajeev,

Have you tried my weblog?

/people/michal.krawczyk2/blog/2005/03/04/globalcontainer--in-graphical-mapping-xi

Regards,

michal

Message was edited by: Michal Krawczyk

Former Member
0 Kudos

Michal,

Thanks for the reply and I exactly did the same thing.

Suppose I am having 2 calculated fields C1 and C2 in target format I used

calculation->value->C1 and calcualation->value->container.getGlobalContainer().setParameter("test",value of C1);

and C2 as

(String)container.getGlobalContainer().getParameter("test")->calculation->C2

but the container value is coming as null.

(I tested by hardcoding value of container in earlier Java function but same result null values)

Regards

Rajeev

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

but have you really tried my example?

did it work?

globalcontainer is a array of strings

this will enable you to get all of the values:

String[] b = (String[]) globalContainer1.getParameter("test");

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

{

result.addValue(b<i>);

}

please try my example first, using container is very simple once you get it right

Regards,

michal

Former Member
0 Kudos

Thanks for the reply.Actually now I am getting the resultant string in the getParameter but when I say Display Queue it shows me null.

Is it such that container directly maps the value and does not queues the same?

Regards

Rajeev

MichalKrawczyk
Active Contributor
0 Kudos

hi,

test it with the "Test" function and not "Display Queue"

for me Display Queue never worked with globalcontainer but it always works with the standard test

Regards,

michal

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

There is also another method by which you can use values across different functions.

IN your Integration Builder, while you are in your Message Mapping, under the Design tab there is a small menubar.

Choose the rightmost option which is called Edit Java Sections. Using this you can use global variables which have a scope of the entire mapping. That means you can use them anywhere in the mapping.

Only remember to populate the variables with valid data before using them in other functions.

Let me explain with an example.

Once you click on Java sections, a smaller box opens up which has 3 fields.

Under the first field called Global Variables we can give something like:

String a;

Under second field called Initialization Section we can give:

a = " ";

Now we can use this variable a in any UDF to store some value and this same variable can be used again to retrieve the value.

This eliminates the need of using containers within the same mapping.

Glad to be able to help.

Regards,

Kshitij

MichalKrawczyk
Active Contributor
0 Kudos

it doesn't work?

if not tell me:) maybe I can help

Regards,

michal