on 08-12-2010 3:59 AM
Dear friend's
I have one requirement as follows
There is field - First Name from soure . This file is mandatory to Target based on condition.
Condition:
There is field Application Type from source.
When the Application type is "P" then First Name is Mandatory in target
When the Appication Type is "A" then First name is optional in target.
How to make this possible?
Renu
>
> There is field Application Type from source.
>
> When the Application type is "P" then First Name is Mandatory in target
>
> When the Appication Type is "A" then First name is optional in target.
>
> How to make this possible?
When you define target data type structure , you will specify the occurance of of your field , mandatory or 0 to 1 ot 1 to unbounded or 0 to unbounded.
in your case you have to define File name field not mandatory becayse one case you no need to pass the value.
you can check the condition using boolean equals like
ApplicationType
BooleanEquals---------->if then else------>target
Constant[P]
if applicatuon type P then pass the value as per your requirement else pass othe rvalue.
one you define occurace of the element in data type,it is not possible to change in mapping level.
Regards,
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Renu,
As mentioned earlier, we are surely required to make the field 0:1.
However, if it is something like a runtime exception that you want to implement if the condition fails, one option would be to make the mapping fail using a udf which would fail if the field is empty like what is given below:-
-
String testFirst="";
String res=firstname;
if(type.equalsIgnoreCase("P"))
{
testFirst = firstname.substring(0,1);
}
else
{
res= firstname;
}
return res;
-
Here if firstname is emply, the substring would fail and would raise a runtime exception. Now if you dont want a runtime exception and just a trace is required, then we can go for a try catch block in the if.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
There is field Application Type from source.
When the Application type is "P" then First Name is Mandatory in target
When the Appication Type is "A" then First name is optional in target.
Make the target field optional.
If Application type is "P" then map to the target field from source.
If Application type is "A" then DONT map to the target field from source.
Babu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.