Skip to Content
0

UDF for WERKS filed

Nov 04, 2016 at 02:30 PM

59

avatar image
Former Member

Hi All,

I am working on UDF for WERKS filed, Kindly suggest the logic for below rule.

The rule is :

if the value is find in the list ("AB01","AB14","AB15","AB16","AB17"), keep the first found in this list and remove the "B" (Example : AB01 -> A01) else force the value to "A22"

so in this case we don’t find any of these values in the list ("AB01","AB14","AB15","AB16","AB17")

.

Thanks in advance..!

Regards,

Srikanth

10 |10000 characters needed characters left characters exceeded

Hi Srikanth!

In your case you could use standard FixValues function instead of UDF.

Regards, Evgeniy.

0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
avatar image
Former Member Nov 04, 2016 at 02:53 PM
1

Hi Srikanth,

Use below UDF.

public String mapWerks(String input, Container container) throws StreamTransformationException {
		List<String> list = Arrays.asList("AB01", "AB14", "AB15", "AB16", "AB17");
		if (list.contains(input))
			return input.replace("B", "");
		else
			return "A22";
	}

Regards,

Praveen.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Nov 06, 2016 at 08:18 PM
1

The requirement was a UDF so Praveen's will fit.

There is a standard function that does this though - called FixValues underneath conversions;

Pass Werks through this in your message mapping.


capture.png (10.1 kB)
Share
10 |10000 characters needed characters left characters exceeded