cancel
Showing results for 
Search instead for 
Did you mean: 

UDF split not working

Former Member
0 Kudos

Hi experts,

I am having an UDF which splits the input to many and this doesn't seems to be working. can you please help me here. thanks

you

Accepted Solutions (1)

Accepted Solutions (1)

former_member190293
Active Contributor

Hi Tom!

I may be wrong, but first value in your queue seems to be equal to "__cC_" (ResultList.CC constant). When it's splitted, you have only one element in "tokens" array - tokens[0]. Thus, you get "ArrayIndexOutOfBoundsException" exception as you try to use other array elements, that not exist.

Regards, Evgeniy.

former_member190293
Active Contributor
0 Kudos

Besides, it's worth mention that your UDF expects queue without any context changes inside.

Former Member
0 Kudos

Thanks for your reply Evgenily. Can you please me how can I correct it. I am new to JAVA and the UDF was written by developer.

former_member190293
Active Contributor
0 Kudos

Hi Tom!

I don't know your mapping logic 🙂 Try this:

if (strValue[i].equals(ResultList.CC)) {
SHKZG.addContextChange();
WRBTR.addContextChange();
MWSKZ.addContextChange();
SAKNR.addContextChange();
KOSTL.addContextChange();
AUFNR.addContextChange();
SGTXT.addContextChange();

}
else if (!strValue[i].equals("")) {

... your rest code.

Regards, Evgeniy.

Former Member
0 Kudos

thanks. but its still the same. I have an entries in GLAccount field but still its not considering it.

your valuable suggestions would be really appreciated. thanks once again.
former_member190293
Active Contributor
0 Kudos

UDF raises exception again?

Former Member
0 Kudos

Hi Evgenily,

yes. it is giving the same exceptions. thanks

former_member190293
Active Contributor
0 Kudos

Tom, your UDF uses "/" as separator for tokens when splitting the string. In your source queue I can't see any string formatted like that.

Regards,Evgeniy.

Former Member
0 Kudos

thanks eveginy. it helped. it was an issue with the wrong input data as you pointed out.

thanks once again.

Answers (2)

Answers (2)

former_member207703
Active Participant
0 Kudos

Hi Tom,

Error correctly specify ArrayIndexOutofBoundsException : 1, that means, it not able to get second value in tokken[] array after split.

tokken[1] doesn't exist while running this UDF. I means there is no "/" in your source string, and it only generate tokken[0] and unable to generate rest.

Why you are using SplitbyValue before UDF, if you are spluiting this String in UDF also? I don't get that logic.

Can you share your GLAccount Source message example, that you are forwarding to target and getting this error.

Thanks and regards,

Anoop Rai

Former Member
0 Kudos

Hi Tom,

use "mapwithDefault" before UDF.

Regards,

Sateesh.

Former Member
0 Kudos

HI Sateesh,

I added map with default but I am still getting the same error. thnaks

Former Member
0 Kudos

Hi Tom,

We faced same issue for some other UDF(as UDF is not accepting null/CC/SUPRESS values) and we have handled by adding some default value in "mapWithDefault" later in UDF we are removing that.

set the default value in "mapWithDefault" as some unused char/number later in UDF remove those by using IF condition and return as "".

Regards,

Sateesh.

former_member190293
Active Contributor
0 Kudos

It will work only in case of one value in input queue. Otherwise, SplitByValue function used next will add context changes after each value as well.

Former Member
0 Kudos

We can put the "mapWithDefault" before "splitByValue".we have created one UDF after the main UDF as below which will supress the default values which we set earlier.

Regards,

Sateesh.