Data Model > Extending the UNICOM Intelligence Data Model > Working with the Alias Map component > Examples of configuring the Generator > 1: Simple example
 
1: Simple example
The following examples shows how the text Data Collection Development Library can be compressed to DDL. The examples do not use a counter to handle duplicates. So, for example,Data Definition Language would also map to DDL.
VBScript example
Private Sub Example_1()
Dim MyConfiguration As MRALIASMAPLib.IGeneratorConfiguration
Dim MyGenerator As New MRALIASMAPLib.Generator

Set MyConfiguration = MyGenerator.Configuration

'Clear the default configuration
MyConfiguration.Clear
'Define the maximum number of characters
MyConfiguration.MaxLength = 6
'Remove everything not an uppercase English letter
MyConfiguration.Rules.AddNew "[^A-Z]+"

MyGenerator.Text = "Data Collection Development Library"
'Print the output, which is "DDL"
Debug.Print MyGenerator.Alias
End Sub
mrScript example
Sub Example_1()
Dim MyConfiguration, MyGenerator
Set MyGenerator = CreateObject("MRALIASMAP.Generator")

Set MyConfiguration = MyGenerator.Configuration

'Clear the default configuration
MyConfiguration.Clear()
'Define the maximum number of characters
MyConfiguration.MaxLength = 6
'Remove everything not an uppercase English letter
MyConfiguration.Rules.AddNew("[^A-Z]+")

MyGenerator.Text = "Data Collection Development Library"
'Print the output, which is "DDL"
Debug.Log(MyGenerator.Alias)
End Sub
In this example there is only one rule, created in the line MyConfiguration.Rules.AddNew ("[^A-Z]+"). [^A-Z]+ is a regular expression, which matches any character that is not an uppercase English letter. The rule replaces characters matching this pattern with the result of the ReplacementCollection. However, the ReplacementCollection is empty (because we did not define it), so the rule effectively removes everything except the uppercase letters and passes them to the next rule. However, the uppercase letters are left unchanged because there are no more rules.
See also
2: Avoiding duplicates
3: Configuring the counter
4: Further examples of configuring the counter
5: Short aliases
6: Complete examples
7: Multiple aliases
Examples of configuring the Generator