Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2800

UDF to check and raise exception

$
0
0

Hi Experts,

 

The occurrence of target structure is 0..unbounded, and I am trying an UDF to check whether the input is multiple of 10, if it is a multiple of 10 then actual input value should be returned else if it is not a multiple of 10 then an exception should be raised.I tried with below code but it throws errors while activating it.

 

public String CheckValue(String var1, Container container) throws StreamTransformationException{

if (!(var1%%10).equals("0")) {

    return var1;

} else {

    throw new StreamTransformationException("Here is error message");

}

}

 

The errors I get are as below:

 

"Function CheckValue, Line 1:

operator % cannot be applied to java.lang.String,int if (!(var1%10).equals("0")) {           ^ Note: /usr/sap/XYZ/J00/j2ee/cluster/server0/./temp/classpath_resolver/Mapfbe07f76eb4511e5ccf70000006640c2/source/com/sap/xi/tf/_yyyyyyyyyyy.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error "

 

Thanks,

Nithin.


Viewing all articles
Browse latest Browse all 2800

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>