Skip to Content
avatar image
Former Member

UDF for WERKS filed

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

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

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 06, 2016 at 08:18 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded