Script to Change order of Attributes within an Entity

Hi,

I have a script that performs an number of Standardisations that are specific to the Company I'm working for. Amongst those Standardisations is adding a set of control columns.

One of the control columns in the "BusinessDate" and is supposed to be the column subsequent to the PK.

So I have 2 things I need to do,

  1. Move the PK Columns to be the first set of columns
  2. Create the "BusinessDate" column in positionN+1 columns wher N is the number of columns of the primary key.

My question is, where do I get the position of the attribute within the entity from?

Kind Regards

Sandy

Hi Sandy,

See attached script: MovePKAttributes.txt (1.8 KB)

I use Move method from Attributes list in this script.

Other way is using this:

 Attributes.InitSort();
 var temp = Attribute1.Ordinal;
 Attr1.Ordinal = Attr2.Ordinal;  
 Attr2.Ordinal = temp;            
 Attributes.Sort(); //command to sort list by Ordinal value

Regards,

Mario