cancel
Showing results for 
Search instead for 
Did you mean: 

Help regarding mapping

justin_santhanam
Active Contributor
0 Kudos

Hi Guys,

Please see the below message. I done mapping like if multiple rows in the source then it mapped to the correctly. But I faced another problem like there are multiple<Statement_response> which contain mulitple rows, how to achieve this.

<b><u>Source</u></b>

<Statement_response>(1to unb)

<row>(1 to unb)

<name>j</name>

<place>M<place>

</row>

</Statement_response>

<u><b>Target</b></u>

<Message>

<row>(1 to unb)

</row>

</Message>

Example:

<i><u><b>Source</b></u></i>

<Statement_response>

<row>

<name>j</name>

<place>M<place>

</row>

<row>

<name>l</name>

<place>n<place>

<row>

</Statement_response>

<Statement_response>

<row>

<name>o</name>

</row>

</Statement_response>

<b><i><u>Target</u></i></b>

<Message>

<row>

<name>j</name>

<place>M<place>

</row>

<row>

<name>l</name>

<place>n<place>

</row>

<row>

<name>o</name>

</row>

</Mesage>

Best Regards,

J

Accepted Solutions (1)

Accepted Solutions (1)

MichalKrawczyk
Active Contributor
0 Kudos

hi,

the mapping is quite similar

at first go to messages tab and change the occurance

of the source message from 1 to unbounded

then just map

<row> <name><place> tags and check the mapping

in test tab

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>

justin_santhanam
Active Contributor
0 Kudos

Michal,

Thanks for ur quick response. I used remove context for the row element and achiveved the same.

Regards,

Raj

justin_santhanam
Active Contributor
0 Kudos

Michal,

I need one more solution,my scenario is AS400 to XI, I used sender JDBC adapter to pick some fields from the database, after that I have to create an SQL statement using UDF and get the response back from AS400. The problem is consider i'm having record item. If I get multiple items when selecting from the database then while creating query(using UDF) i'm getting the same query repeated for all the items. How to avoid this? If I have multiple items with different values then no issues ,as per my scenario I need to create multiple queries but if all the item values are same then still its creating the same query for all the items.

Plz help me in this regard.

Regards,

J.

MichalKrawczyk
Active Contributor
0 Kudos

hi,

you can use global variables

/people/sap.user72/blog/2005/10/01/xi-new-features-in-sp14

and inside your UDF check the variable:

if it's = X for instance then fire the query

and at the end set the variable to X

this way it will only be executed once

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>

henrique_pinto
Active Contributor
0 Kudos

In your JDBC request message, create a queue UDF with a logic like this:

...
result.addValue(a[0]);
for (int i = 1; i < a.length; i++) {
  if (!a<i>.equals(a[i-1])) {
    result.addValue(a<i>);
  }
}
...

The input of UDF should be field containing the Query string with removeContext function.

Regards,

Henrique.

Former Member
0 Kudos

HI,

See the below link

GlobalContainer - in graphical mapping (XI) - /people/michal.krawczyk2/blog/2005/03/04/globalcontainer--in-graphical-mapping-xi

if your SP is more or equal 14 then

XI: New features in SP14 - Global variable in mapping - /people/sap.user72/blog/2005/10/01/xi-new-features-in-sp14

or you need to use the Dynamic SQL Option

Regards

Chilla

justin_santhanam
Active Contributor
0 Kudos

Hello Guys,

Plz look my below scenario and tell me ur suggestion.

My input file will be like the below format:

Case 1:

<Test_Message>

<row>

<Emp_id>10003</Emp_id>

<Emp_name>J</Emp_name>

</row>

<row>

<Emp_id>10004</Emp_id>

<Emp_name>K</Emp_name>

</row>

</Test_Message>

Case 2:

<Test_Message>

<row>

<Emp_id>10003</Emp_id>

<Emp_name>J</Emp_name>

</row>

<row>

<Emp_id>10003</Emp_id>

<Emp_name>J</Emp_name>

</row>

</Test_Message>

So based on the Emp_Id I'll use create Sql query using UDF and will fetch data from the database. The mapping is done such a way tht for each row based on <Emp_ID> I'll create sql query(using UDF) and will fetch the data. My scenario works fine with the case 1 input. But if u look into case 2, I don't want to create two sql queries since the emp_id's are same,instead I've to create single sql query. How to achieve this.

Best Rgds,

Raj

henrique_pinto
Active Contributor
0 Kudos

The way I told. 😛

You can have 2 message mappings in your interface mapping. In the first 1, you use queue UDFs (for both Emp_id and Emp_name fields) the way I told in the last message. The 2nd message mapping is the one you already have now, for creating the queries.

Regards,

Henrique.

Former Member

Answers (0)