cancel
Showing results for 
Search instead for 
Did you mean: 

Req for UDF

Former Member
0 Kudos

Hi All,

In Mapping I have to check for a field, ie if the field has value i need to pass it to target or else need to throw error.

mapping is X (1) ---> Y (0..1) , X is coming from CSV file , if i give blank in the file its processign , but it should throw error.

Do i need to write UDF or can i do it using graphical mapping..

Thanks ,

Monish.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

use this UDF


if(a.equals(""))
throw new RuntimeException("Empty input");
else return a;

use mapping


Sourcefield---.UDF--->TargetField

Check this blog also

[/people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping

]

Edited by: Kubra fatima on Jul 9, 2009 9:33 AM

Former Member
0 Kudos

use the mapping as given below


sourceField---.equalS---->not---->createIf----->targetField
  constant[]/

do not give any value in the contant function

Former Member
0 Kudos

With above mapping it's not throwing any error if the source filed is blank , which is not the requirement , it should throw some mapping error stating that source field is empty

Former Member
0 Kudos

Hi,

Why you are not trying with alerts?

You can write UDF to check for field if, field is blank throw some exception.

You can raise alert if any error occurs ,and it can be reiceved at your RWB mail box as well.

For alerts , refer folowing discussion:

Best Regards,

Divyesh

Former Member
0 Kudos

HI,

Can you change the occurance of target field as 1..1. and keep the same mapping. In that case it will through an runtime error when source field is space.

Regards,

shweta

Former Member
0 Kudos

HI,

Yes you need to write a UDF. In this UDF check the value to X field. If it is space then through an error else return the value.

Regards,

Shweta.

MichalKrawczyk
Active Contributor
0 Kudos
Former Member
0 Kudos

Hi,

Here i need to throw error in mapping itself if the value is blank .

Thanks,

Monish

MichalKrawczyk
Active Contributor
0 Kudos

hi,

then you should not do it in the mapping but in the receiver determination

try adding a condition in the receiver determination that will check that field

and if it's not there the message will go into an error

Regards,

Michal Krawczyk