Skip to Content

how to remove context in PI using UDF ?

can anyone help me on this.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Oct 18, 2016 at 11:32 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 19, 2016 at 02:38 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 19, 2016 at 03:02 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded