on 08-29-2013 11:15 AM
Hi Experts,
I need one help from you.I have a scenerio where I have one field as email id.
If sender is sending the value for eail id than it will be mapped to target email else I have to take the first name and last name than dynamically I have create the email id for them in target sturcture.
Ex in case email value is coming...abhinav@yahoo.com--->mapped to target email...else abhinav.verma@yahoo.com will go o target.
First name.LastName@yahoo.com if no email id is coming.
Please let me know how to do that in mapping..
Regards,
Abhi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhinav,
I am not sure why you are not using mapWithDefault with blank value.
Currently the mapping you did is working as expected.
You are checking whether the node exist or not.
And since u can see the node exist even thought its blank in your source message hence true condition is executing..
My suggestion again would be use mapWithDefault and test it.
thanks and regards,
Praveen T
Hi Praveen,
Thanks for sharing the info.It is working fine now.I have one more doubt if I am not passing last name than email id in output is coming like:-abhinav_@yahoo.com.(General email id structure abhinav_verma@yahoo.com)
Can you please suggest so that i will fix this criteria also.
Regards,
Abhi
hi Abhinav,
May i know what do u want to be the output if last name is not present.
Note: There is difference between node being not present and value in the node being not present.
Absence of node can be handled using mapwithdefault and blank values condition can be fixed using if then else condtion.
thanks and regards,
Praveen T
Hi Praveen,
If last name is not present than it should be mapped with team id.What I mean to say if email id of that person doesnt exists than info will go to team mail id.ex pi_developement_team@abc.com
Regards,
Abhi
Hi,
can you share us your input and expected output xml? (with email id,without email id)
it can help us to get your requirement better.
Regards,
Muniyappan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hey Abhinav,
What I understand is that you are not using Exists function correctly. There is always a confusion with blank value and unavailable value.
you can just use one simple UDF. take first name, lastName and emailID as input. use MapWithDefult[X] for emailID
if(emailID.isequal("")||emailID.equals('X'))
return firstname+"_"+LastName;
Regards,
Gavaksh Saxena.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Gavaksh,
Sorry Gavaksh for replying it so late.I was not well last week so didnt get the chance to see your suggestion.
Gavaksh,we are looking to minimize the load on PI so in most of the cases we are avoiding writing UDF.UDF we wrote but customer dint approved it.So we are using mapping concept to fix this issue.
We have 2 options either to apply the mapping concept in PI or fix this issue in ECC part only by writing a abap program.
I am trying to apply mapping to fix this in PI only.
Regards,
Abhi
Use below mapping
I have used Marks for email id(you can replace Marks field with Email id field) and replace EMPName field with the concatenated values( firstname+lastname+@smting.com).
Here, there are many records in the source side. 2nd record does not contain MARKS field while 3rd record contain blank value. this mapping will check both the conditions. PFB the screenshot for the queues of Marks field and EqualS function
Also,, you can see the output queue below. for 2nd and 3rd Record, where mark field was unavailable and blank, EMPName is fwd to the target.
Please let me know if you have any confusions.
Regards,
Gavaksh Saxena
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhi,
then use (If) and it should work.
difference between (If) and (ifs)
http://scn.sap.com/message/5968650#5968650
if you still face any specific issues do let us know.
thanks and regards,
Praveen T
[sourceEmail] --> [mapWithDefault]-->[equals ] --------> [if and else] then
[blank constant]
if true map [SourceEmail]
else map
[firstname] [concat] [.(constant)]
[concat]
[latname][concat][@yahoo.com]
thanks and regards,
Praveen T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use Email validation UDF for the same...try with below code..
public void validate(String emailid[],ResultList result,Container container)throws StreamTransformationException{
for(int i=0;i<emailid.length;++i)
{ if(emailid[i].matches("^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"))
{ return emailid;
}
else
{ return (Set condition as per your requirement);
}
}
}
In mapping set a Condition..
Source Email Field > UDF Validation > Target Email Field
Hope it helps.!
Regards,
Sunil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
You can use this mapping:
emailid -> \
emailid -> exist ----------> ifS --> emailid
firstname -> concat[.] -> /
lastname -> /
Hope this helps,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.