cancel
Showing results for 
Search instead for 
Did you mean: 

UDF for WERKS filed

0 Kudos

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

former_member190293
Active Contributor
0 Kudos

Hi Srikanth!

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

Regards, Evgeniy.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182412
Active Contributor

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.

Answers (1)

Answers (1)

Former Member

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.