cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Item sequence using GetCollection

Solved
Highlighted
Occasional Contributor

Item sequence using GetCollection

Hi.

 

When looking at Entity (DM) properties in MEGA, under the Attributes tab the Attributes are listed and can be sequenced using reorganize.

 

I am using GetCollection in a VB Script to bring back Attribute (DM) objects for an Entity (DM) and want to get them ordered in the same sequence as they appear in the properties tab.

Can someone advise me how to locate the sequence key so I can sort by this?

 

Any help much appreciated....

 

Craig

2 Replies
Highlighted
MEGA

Re: Item sequence using GetCollection

Hello Craig,

 

in a getCollection, you can add the attribut on which your collection should be sorted.

For example, in the display of an entity's properties, attributes are displayed by order  -->  You then need to add the "order" attribute to your getCollection : getCollection(<link>, <sort attribute 1>, <sort attribute 2>...)

 

For exemple :

 

Set oEntity = getObjectFromId("MUIH5M4LDvR0")
For Each oAttribute in oEntity.GetCollection("Attribut (MD)", "Order")
  Print oAttribute.getProp("Short Name")
Next

Regards,

 

Lionel

Highlighted
Occasional Contributor

Re: Item sequence using GetCollection

Hi Lionel.

Sorry for the late reply but I have been on leave.

That works perfectly. Thank you very much for you help..