Hello Friends,
Today I got a situation where I have a address node in which complete address was stored with comma(,) separated like "Madhapur, Hyderabad, India".
What I wanted to do is that extract every single separted with comma and map to different different node to target schema.
For Example, "Madhapur" to "City" node
"Hyderabad" to "State" node
"India " to "country" node in Target Schema.
For yor better I am attaching sample screenshots here.
1. This is the input file for map
As you can see in this xml file that we have node called Address under which we have value stored
"Madhapur, Hyderabad, India" with comma separated.
2. Screenshot of Map
As you can see that in target schema "TargetAddress" we have three nodes City, State and Country in which I am assigning three different values which is stored under Address in source schema with comma separated by using scripting functiod.
Now what you have to do is.Just take 3 different scripting functoids and place it on the map.
------Code for First Scripting Functoid..i.e for City Node.------
public string City(string str)
{
string[] words = str.Split(',');
string result= words.GetValue(0).ToString();
return result;
}
------Code for First Scripting Functoid..i.e for State Node.------
public string State(string str)
{
string[] words = str.Split(',');
string result= words.GetValue(1).ToString();
return result;
}
------Code for First Scripting Functoid..i.e for Country Node.------
public string Country(string str)
{
string[] words = str.Split(',');
string result= words.GetValue(2).ToString();
return result;
}
when you use these three scripting functoids we will get our desired results as below:
As you can see that these values has been mapped to respective nodes.
Thank you for reading this.
Anshu Kumar
Gud Job Sir... Keep it up
ReplyDeletethank you for inspiring me praveen
DeleteThanks Anshu Kumar, your post on Splitting Delimited Values of single node in BizTalk is very helpful for me.
ReplyDeletethanks once again..
ReplyDelete