Skip to Content
author's profile photo Former Member
Former Member

UDF help

Hi XI gurus,

I am not an expert with JAVA programming so I'm having this problem regarding the UDF that I need to create. I need to group transactions according to 2 different fields. For example:


Material Price Date

Cotton 1.00 02-28-11

Wood 5.50 01-08-11

Metal 10.0 01-25-11

Cotton 1.00 01-25-11

Wood 5.50 01-25-11

I need to group the transactions that have equal Material and Price.

Output should be:


Cotton 1.0 02-28-11

Cotton 1.0 01-25-11


Wood 5.50 01-08-11

Wood 5.50 01-25-11


Metal 10.0 01-25-11

Is this possible via UDF?

Any help would be greatly appreciated. Thanks!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on May 23, 2011 at 03:50 AM

    First you have to write logic for IDoc segment like below.

    material>removecontext->sort>splitby value(valuechange)->collapsecontect---->IDoc.

    This logic will genarate one IDoc same material,like multiple IDocs for Multiple different materials.



    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member


      For the child fields use this function

      valueKeyQueue - should be material

      valueQueue - should be for example price or date

      valueQueue - this entire structure material >removecontext ->sort >splitby value(valuechange) ->collapsecontect---->I

      don't forget splitByValue after the call to the UDF

      public static void findValuesByKeysForSearchKeys(String[] valueKeyQueue, String[] valueQueue, String[] searchKeyQueue, ResultList result) throws StreamTransformationException{
      		for (int i = 0; i < searchKeyQueue.length; i++) {
      			// Is the current entry a context change?
      			if (searchKeyQueue<i>.equals(ResultList.CC)) {
      				// add the context change itself to the result queue
      			} else {
      				// find the value in the valueQueue
      				boolean found = false;
      				int j = 0;
      				while (j < valueKeyQueue.length && !found) {
      					if (valueKeyQueue[j].equals(searchKeyQueue<i>)) {
      						found = true;
      						if (j<valueQueue.length)
      					} else {
      				if (!found) {

  • Posted on May 22, 2011 at 01:23 PM

    you can use standard function to achieve this.

    examples field ---> removecontext --> sort ---> splitbyvalue(value change) -> idoc1 like that.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.