Skip to Content

PI v7.3 Process ResultList from UDF in another UDF

I am in need of some help. We are writing a UDF to gather data from multiple sources. Several of those sources are already built UDF functions in another library. We can call the UDF functions from the other library, but we are having issues with parsing the data that is returned.

As an example:

UDF A->genAddressText(String[] inXML, String[] inQualifier, ResultList result);

This function will parse the XML and return formatted address lines for the XML given.

UDF B->genInstructions(String[] inXML, ResultList result);

This is the new function that will call the UDF A->genAddress();

In the genInstructions - we call the UDF A->genAddress as such:

String[] inQualifier = {"ZC"};

String[] inDestEurope = { "true" };

//Calling genAddressText UDF to get Final Destination Address

ResultListImpl address = new ResultListImpl();

_Forms_test_.genAddressText(inxml,inQualifier, inDestEurope, (ResultList) address,container);

container.getTrace().addWarning ("address is empty? " + (address.isEmpty()? " true": " false"));

String[] finalDestination = null;

if (address != null) {

container.getTrace().addWarning ("address is not null");

finalDestination = (String[]) address.get();



However, we get a null pointer exception when there is any data. It seems the "get" is not returning a String[] or Object[] but just an Object. Is there a way to parse the records in the ResultList returned?

I have reviewed and tried the example shown in this thread, but it doesn't work either:

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Apr 26, 2016 at 02:54 AM

    Hi Brian

    In order to parse the content in the ResultList, you need to iterate through it using the get() method one at a time, and then use pop() to move to the next value. ResultList can accept different content, so not necessarily everything is stored as String.

    Refer below an example of one UDF calling another and the result.

    First UDF which stores two values, one String and one integer.

    Second UDF calls first UDF, then iterate through the ResultList

    Output when second UDF is used in mapping.

    Hope this helps.


    Eng Swee

    udf1.png (4.1 kB)
    udf2.png (18.3 kB)
    output.png (18.4 kB)
    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.