This video is a brief introduction on how to create key groups / Indexes in Erwin Data Modeler.It also demonstrates the use of Macros to name the indexes
Refer "Template Language and Macro Reference" PDF by ERwin.
The following is the Macro I have used in the demo.
This macro has additional logic than just get the number from the keytype and add it to our index name, it checks if the number is less than ten, if so it will add a zero in front of it( this calculation is done using the If statements)
%Switch(%Substr(%KeyType,1,2))
{
%Choose(pk) {x_%tablename_pk}
%Choose(ak) {x_%tablename_uk_%if(%==(0,%/(substr(%keyType,3,4),10))) ) {%concat(0,%substr(%keyType,3,4))} %else {%substr(%keyType,3,4)}}
%Default {x_%tablename_%if(%==(0,%/(substr(%keyType,3,4),10))) ) {%concat(0,%substr(%keyType,3,4))} %else {%substr(%keyType,3,4)}}
}
![](https://i.ytimg.com/vi/qi58jeJY_ig/maxresdefault.jpg)