I was catching up on my RSS feeds today, and I stumbled upon Alex Tcherniakhovski’s video on Very practical example of using MapAttributesForJoin Method.  It’s an excellent video tutorial on using the MAFJ function.

In summary it goes into converting the data type’s to a common data type to map them for a join rule.

I tend to use MAFJ quite heavily because I seem to deal with data systems that store the common data value in various formats.

I would say the most common one that I use, is the normalizing the format for storing the US-SSN identifier between the DS and the MV.   Since often you will not be able to have the DataSource be formatted to what you have in the MV, this is a simple way to control that via extensions.

case "MAFJ_SSN":
{
	// MVentry.SSN = "123456789"
	// CSentry.SSN = "123-45-6789"
	// In order to make them "match" for join they need to
	// be equalized in format

	// using RegularExpressions replace the - in the SSN string
	string mySSN = regex.Replace(csentry["SSN"].Value,"-","").toString();	
		
	// mySSN = "123456789"

	// Add the formatted string to the Values collection to
	// be compared for JOIN.

	values.Add(mySSN);
}
break;

It should be noted that "values" is a ValueCollection so you could fill it with multiple formats of the value you wish to join upon.  I suppose this could be used to map a persons name who might be "Joe", "Joey", "Josef", or "Joseph", so that it correctly joins the "Joe Smith" in the metaverse.  I could see where you would want to join on a common name vs legal format of a name in some systems, but I have never had reason to do this myself.

 
tags: , , 
Advertisements