Skip to Content
0

UDF split not working

Nov 16, 2016 at 06:33 AM

83

avatar image

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

jqi1q.png (32.5 kB)
rawxs.png (92.9 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Evgeniy Kolmakov Nov 16, 2016 at 06:47 AM
1

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.

Show 8 Share
10 |10000 characters needed characters left characters exceeded

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

0

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.

0

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.

0

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.
dhudw.png (39.6 kB)
ayzdm.png (34.9 kB)
0

UDF raises exception again?

0

Hi Evgenily,

yes. it is giving the same exceptions. thanks

0

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.

0
Show more comments
Sateesh Kumar P Nov 16, 2016 at 07:06 AM
0

Hi Tom,

use "mapwithDefault" before UDF.

Regards,

Sateesh.

Show 4 Share
10 |10000 characters needed characters left characters exceeded

HI Sateesh,

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

xmiby.png (73.3 kB)
0

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.

0

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.

0

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.

0
Anoop Rai Nov 18, 2016 at 08:44 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded