Skip to Content
avatar image
Former Member

How to add value in queue in udf


I am newbie in udf,

I have a requirement to add value to the existing queue.

lets say i have one field A which has 10 values and need to add 11 value in the same queue.



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Dec 07, 2016 at 11:40 PM

    Hi Roshan,

    When you create your UDF in PI, make sure the execution type is 'All Values of Queue'. This will add a ResultList to the signature variables. Then add another signature variable of type Argument, with the Java Type as String. Leave the names as default or keep note of them.

    In your UDF use code similar to this;

    String str = "";
    for (int i = 0; i < var1.length; i++) {
    str = var1[i];

    What this is doing is looping through each value in the queue and adding it to the result list. That will store your existing queue values. If you need a context change after each, uncomment the 'result.addContextChange(); code. Otherwise leave it. Then after the loop we add the additional value. In this case i am adding a String saying daniel. You can alternatively declare your own variable inside the UDF, OR create an additional parameter to pass into the function and use that in the code.

    Have fun playing and let me know if you have difficulties.


    var1 is the name of the String parameter on the UDF definition.

    result is the name of the ResultList parameter. If you change either of these names replace them in the code.

    Add comment
    10|10000 characters needed characters exceeded