Quantcast
Channel: SCN : All Content - Process Integration (PI) & SOA Middleware
Viewing all articles
Browse latest Browse all 7030

Add a context change after a set of values in a context

$
0
0

Dear experts,
My requirement is as follows:
Scenario: Idoc to Idoc. I need to check if there are line items > 5- I need to do a split. The split is happening properly via my mapping but I have a problem at the header record level on the target- I do not get the values populated correctly. I need to add a context change after 5 values in the queue.

eg:
Say there are 2 Idocs at the source with following unique IDs: called Journal ID:

 

My source:
Idoc 1: Journal ID 123
Line Itme 1
Line Item 2
Idoc 2: Journal ID 124
Line item 1
Line item 2
Line item 3
Line item 4
Line item 5
Line item 6
Line item 7

 

So I need to get total of three Idocs in my target:
Idoc 1: Journal Entry 123
Line Item 1
Line Item 2
Idoc2: Journal Entry 124
Line item 1
Line item 2
Line item 3
Line item 4
Line item 5
Idoc3: Journal entry 124
Line item 6(new 1)
Line item 7(new 2)

 

The split in the target Idoc is working perfectly. But inside the header record the journal ID field(taken from Item record level) is not populating correctly. I am getting this output:

 

Idoc 1: Journal Entry 123
Header Record-->JournalID Field value= '123'
Line Item 1
Line Item 2
Idoc2: Journal Entry 124
Header Record-->JournalID Field value= '124'
Line item 1
Line item 2
Line item 3
Line item 4
Line item 5
Idoc3: Journal entry 124
Header Record-->JournalID Field value= Null
Line item 6(new 1)
Line item 7(new 2)

 

So please suggest a UDF/standard function to populate the right values inside header record--->Journal ID field.Something like the below...

 

public void calculate(String[] var1, ResultList result, Container container) throws StreamTransformationException{

  for ( int i = 0; i < var1.length; i++ )
  {
     if( var1[i].length() > 5) //here var1 I am passing the Journal ID
       result.addContextChange();
  }

}

Apparently this doesnt work.


Viewing all articles
Browse latest Browse all 7030

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>