Data Model > Extending the UNICOM Intelligence Data Model > Creating a Metadata Source Component (MDSC) > Populating the MDM Document > Using the Alias Map component
 
Using the Alias Map component
You can use the Working with the Alias Map component component to create unique variable and element names that follow the naming rules of the DataSource. If you use the Alias Map component to create both variable and element names, you need to use two alias maps.
You can usually assume that the MDM Document is empty. This means that name conflicts can occur only between new names and you do not need to preload the Alias Map dictionary with existing names. This assumption makes it much easier to implement the MDSC.
Here is a Visual C++ example of setting up the Alias Map configuration to create valid MDM names. This is a simple example and it does not attempt to make elegant names, merely valid ones. In addition, it does not attempt to shorten the names because the MDM does not limit the lengths of names. However, the example can easily be adjusted to meet specific requirements and to suit the exact nature of the input. For Visual Basic examples of configuring the Alias Map component, see Examples of configuring the Generator.
#import "mrAliasMap.dll" rename_namespace("ALIAS")
void ConfigureAliasMapForNames(ALIAS::IGeneratorConfigurationPtr pGC)
{
pGC->Clear();
pGC->AutoCounters->AddNew();
pGC->Rules->AddNew("$")->Replacements->AddOperator(ALIAS::ropAutoCounter, 0);

ALIAS::IReplacementCollectionPtr pRC;

// Strip invalid chars followed by valid chars that are not valid lead char.
pRC = pGC->Rules->AddNew("^[^A-Za-z\\x{80}-\\x{fffe}0-9_#@$]*([0-9#@$]+)")->Replacements;
// Prefix invalid lead character with underscore.
pRC->AddText("_");
pRC->AddOperator(ALIAS::ropMatch, 1); // Prefix with _.

// Replace invalid characters with _.
pGC->Rules->AddNew("[^A-Za-z\\x{80}-\\x{fffe}_0-9#@$]+")->Replacements->AddText("_");
// Unlimited variable name length.
pGC->PutMaxLength(0);
}
See also
Setting up the Document
Setting up basic questions
Setting up elements
Setting up helper fields
Setting up shared category lists
Setting up complex questions
Setting up the routing
Setting up custom properties
Versions
Visual C++ examples
Populating the MDM Document