Skip to Content
0

how to remove context in PI using UDF ?

Oct 18, 2016 at 07:19 PM

406

avatar image
Former Member

can anyone help me on this.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Evgeniy Kolmakov Oct 18, 2016 at 11:32 PM
1

Hi Shashi!

Why not to use standard function RemoveContext?

public void removeContexts(String[] inbQueue, ResultList result, Container container) throws StreamTransformationException{

for (int i=0; i<inbQueue.length; i++)

    if (!inbQueue[i].equals(ResultList.CC))

        result.addValue(inbQueue[i]);

}

Regards, Evgeniy.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Oct 19, 2016 at 02:38 AM
0

Can you please help me how to use this in my udf . I have never used slandered code in UDF.

My actual requirement is to remove all suppress and context change in attached file and put these two value in two context.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Oct 19, 2016 at 03:02 AM
0

Hi Shashi,

  • Context change and suppress are constants in the queue. you can access them in the UDF like ResultList.CC for context change and ResultList.SUPPRESS is for supress.
public static final String SUPPRESS = "_sUpPresSeD_";
public static final String CC = "__cC_";
  • So to remove these values you can use it like below
public void remove(String[] input, ResultList result, Container container) {
	for (int i = 0; i < input.length; i++) {
		if (input[i].equals(ResultList.CC)) {
			// use your logic
		} else if (input[i].equals(ResultList.SUPPRESS)) {
		        // use your logic
		}
	}
}

Regards,

Praveen.

Share
10 |10000 characters needed characters left characters exceeded