cancel
Showing results for 
Search instead for 
Did you mean: 

How to access variable values across mappings?

Former Member
0 Kudos

Hi all,

I have created the following sample class Test.java and imported it as an archive:

public class Test{

public static String myStringData = null;

}

In one of the mappings, I have a UDF that sets the "myStringData" using the foll:

Test.myStringData = "Amit";

I am trying to access this variable in another mapping using a UDF with foll statements:

String test = Test.myStringData;

result.addValue(test);

However, on testing the second mapping I get the value of the variable as null. I have activated all objects.

Not sure what exactly I am missing here...Kindly provide your inputs.

Thanks..

Amit

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

A small correction in the issue:

The Target File structure has some fields which should be mapped with elements contained in output of the "first" stored procedure

Former Member
0 Kudos

Well, I am trying to implement the below mentioned flow:

Stored procedure output--


>Input of Second Stored procedure--->output of Second Stored Procedure----->Target File Structure.

Issue:

The Target File structure has some fields which should be mapped with elements contained in output of the second stored procedure.

I am using a set of 2mappings to achieve this.

Former Member
0 Kudos

Shabarish/Praveen, it would be great if you could provide me with some examples on the suggested approaches as I am relatively new to PI.

Thanks,

Amit.

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

>>>Shabarish/Praveen, it would be great if you could provide me with some examples on the suggested approaches as I am relatively new to PI.

the truth is that you should not write anything from message mappings

as:

what happens if the DB table to which you want to write will be locked

what happens if the file will not be accessible ?

it's better not to write anything from message mappings

especiall if you say you're new to XI

maybe just tell us the real problem - why do you think you need to do it?

Regards,

Michal Krawczyk

Former Member
0 Kudos

I am using PI 7.0

Shabarish_Nair
Active Contributor
0 Kudos

what you are trying to achieve is not possible in 7.0 !!!

I suggest you save the value in a DB or in an abap table via an RFC and retrieve the same when required.

Else also try looking into options like fix value tables, value mapping tables etc as per your requirement and needs.

former_member181985
Active Contributor
0 Kudos

You can also persist the value to a local file in the XI/PI Server and play around with it in mapping.

former_member206760
Active Contributor
0 Kudos

Are you using PI 7.1?

Former Member
0 Kudos

Thanks Praveen for the info.

But then, is there a means of accessing values across mapping. I tried using global container but even that doesn't work.

Regards,

Amit.

former_member181985
Active Contributor
0 Kudos

The second mapping cannot access the variable set by first mapping since java program scope is only for each mapping execution.

Thanks,

- Gujjeti.