Skip to Content
0
Jan 12, 2011 at 10:11 AM

Error Executing UDF

20 Views

Hello,

I have a source message like

<Source>

<Field>CSV</Field>

</Source>

Value of Field can be either CSV or XML. I have to check if the Field has value CSV or XML and also if the Field exists.

I am able to do it using standard functions in mapping, but I want to check it using a UDF.

For the first part (check CSV or XML) I wrote a UDF:

if((!var1.equals("CSV")) || (!var1.equals("XML")))

{

return "fail";

}

else

{

return "pass";

}

Even if Field = CSV or XML, the UDF returns fail (it should return pass). What is wrong in the UDF?

Also how should be the UDF if I have to check for existence of Field?

Field --> UDF --> TargetField

If source Field does not satisfy the conditions then TargetField should not be generated.

~Thanks.