cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

PI Graphical Mapping with loops?

Former Member
0 Likes
3,690

Hi!

I have the following Problem and would like to know if there is an elegant solution to it!

I want to map the Output of a function block to an XML structure. So there is nothing so Special about it

The Problem is the following:

In the source structure there are 2 tables:

Table1:

Field 1, Field 2

xyz     001

abc     002

Table2:

Field 1, Field 2, Field 3

mno     abc    001

abc     xyz     001

xyz     ako     002

A part of the target structure of the XML Looks like this:

<Tag1>

     <Subtag 1>001</Subtag1>

          --> Here All entries from Table 2 whose Field 3 corresponds to Field 2 of Table 1 should be placed!!

               <Tag2>

                    <Subtag2>mno</Subtag2>

                    <Subtag3>abc</Subtag3>

               </Tag2>

               <Tag2>

                    <Subtag2>abc</Subtag2>

                    <Subtag3>xyz</Subtag3>

               </Tag2>

     <Subtag 1>002</Subtag1>

               <Tag2>

                    <Subtag2>xyz</Subtag2>

                    <Subtag3>ako</Subtag3>

               </Tag2>

</Tag1>

Is there a solution to this by a graphical mapping?

BR, EF

View Entire Topic
Former Member
0 Likes

At the Moment i tried the following, but it doesn't work ... the mapping does not put the Suggestion_options under the corresponding order_suggestion!

In the mapping, i check if the suggested_line fields are equal. If so, i try to put the whole order_suggestion_option element to the corresponding order_suggestion_option in the target structure ...

Here is the momentarily wrong result of the mapping ...

gagandeep_batra
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Elmar,

you can achive this by following logic

first use sort  function based on suggested_line and then you can use sortbykey &  split by change  value  function

Regards

Gagan

Former Member
0 Likes

Hi!

I tried to realize your solution and it Looks better, but not entirely ...

Test data is the following:

   <ORDER_SUGGESTION>

      <item>

         <X_SUGGESTION_ID/>

         <DESCRIPTION/>

         <SUGGESTED_LINE>100</SUGGESTED_LINE>

      </item>

   <item>

         <X_SUGGESTION_ID/>

         <DESCRIPTION/>

         <SUGGESTED_LINE>200</SUGGESTED_LINE>

      </item>

   </ORDER_SUGGESTION>

   <ORDER_SUGGESTION_OPTION>

      <item>

         <X_FEATURE_ID>1-1</X_FEATURE_ID>

         <OPTION>1-1</OPTION>

         <SEQUENTIAL_NO>1-1</SEQUENTIAL_NO>

         <SUGGESTED_LINE>100</SUGGESTED_LINE>

      </item>

       <item>

         <X_FEATURE_ID>2-1</X_FEATURE_ID>

         <OPTION>2-1</OPTION>

         <SEQUENTIAL_NO>2-1</SEQUENTIAL_NO>

         <SUGGESTED_LINE>200</SUGGESTED_LINE>

      </item>

      <item>

         <X_FEATURE_ID>1-2</X_FEATURE_ID>

         <OPTION>1-2</OPTION>

         <SEQUENTIAL_NO>1-2</SEQUENTIAL_NO>

         <SUGGESTED_LINE>100</SUGGESTED_LINE>

      </item>

       <item>

         <X_FEATURE_ID>2-2</X_FEATURE_ID>

         <OPTION>2-2</OPTION>

         <SEQUENTIAL_NO>2-2</SEQUENTIAL_NO>

         <SUGGESTED_LINE>200</SUGGESTED_LINE>

      </item>

   </ORDER_SUGGESTION_OPTION>

But, there are items missing in the Output! Items 1-2 and 2-2 are missing at Level 100 or 200 ...

Former Member
0 Likes

Hello,

U can refer below mapping for order_suggestion_option:

Note - i am assuming that values present in suggested_line under order_suggestion will always be there under order_suggestion_option-suggested_line

Thanks

Amit Srivastava

gagandeep_batra
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Elmar,

Plz you can chek below:

I am also amusing that value always present in suggestion is also present in suggestion-option

Regrads

gAgan