Automatic creation of scripts

Hi everybody,

I am currently trying to make a script to create an index for every single primary key present in a physical model. Obviously, I wish every index to have the same columns as the matching primary key.

But all I have been able to come up with until now is a script creating empty indexes. I miss the code piece adding the index columns. Can anyone help ?

Create_Primary_Key_Indexes.js (1.84 KB)

NewIndexItem.Name = CurrentKeyItem.Name;

Vaclav & Mario.


modify the AddIndexForKey function and write this:
NewIndexItem.Attribute = CurrentKeyItem.Attribute;
instead of: