cancel
Showing results for 
Search instead for 
Did you mean: 

Fail the interface on a particular field valu

Former Member
0 Kudos

Hi Gurus,

I am working on a scenario which is File to JDBC. I need to fail the Interface when the header value is not eaqual to "EN". For example I have the input file format like this below

EN 01\01\2010(Header)

US HJ UU 123

US JJ II 123

002(footer)

I wanted to check the first field of header value is equal to "EN". if not equal to "EN" then I need to fail the mapping. Can I achieve this in the graphical mapping. Please explain..

Regards,

Kevin

Accepted Solutions (1)

Accepted Solutions (1)

rajasekhar_reddy14
Active Contributor
0 Kudos

What do you mean by Fail the Interface??

you want red flag in Moni with mapping exception?? if yes then refer previous replies.

else let us know what you want to do if condition not satisfies.

Answers (4)

Answers (4)

Former Member
0 Kudos

Thanks.. it is solved

former_member854360
Active Contributor
0 Kudos

Hi Kevin,

You can use this simple UDF before mapping the EN value to target.

If you use this UDF then you cann see the custom mapping fail reason in SXMB_MONI.

In support phase it will be easier to monitor the interface with custom error message.

public String check(String input, Container container) throws StreamTransformationException{

if(input.equals("EN"))
{
return input;
}
else
{
throw new RuntimeException("Value is not equal to EN"); 

}
}

Former Member
0 Kudos

Hi Kevin,

Keep the cardinatility/ occurance of the field as mandatory. Map the source and the target field with Ifwithout condition.

field-->If (field=EN) then -->target field.

If the value is not equal to EN then it automatically fails.

Thanks,

sridharreddy_kondam
Active Contributor
0 Kudos

Hi Kevin,

If the target field is mandatory for the Header field that you are mapping then you can fail the mapping(Field Occurence is 1...1).

Just use the If condition and map to target only when it is EN. If not satisfied it will fail.

If the Target is not Mandatory field(Occurance is 0..1) then use an UDF to fail.

Thanks and Regards,

Sridhar