var nLocale = Context.getSelectedLanguage(); //Get the number of the used language var selectedModels = ArisData.getSelectedModels(); //Get the EPC models that were selected before starting the report. My context is set to Model > only EPC, but you can allow any model type you want var guidOfUserDefinedAttrib = "8a412ff0-5617-11e1-0b99-d8df42cdfc1b"; //Change this String to the GUID of the user defined attribute for each (var singleModel in selectedModels){ //In case more than one models were selected, do the sorting with all models one after another var unsortedObjOccs = singleModel.ObjOccList(); //Get a list of all Obj occurrences. If you want only object occurences with a certain obj-type or symbol-type take a look at the ObjOccList() method variants, there are some that offer filtering //sort() is a default Javascript method. You can read more about it here https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/sort var sortedObjOccs = unsortedObjOccs.sort(function(a,b){ //By default the sort method can only sort simple object arrays like String arrays or int arrays. To do all the "user defined attribute" stuff the script developer has to define a method by which the array elements are sorted. aUserdefAttrValue = a.ObjDef().Attribute(ArisData.ActiveFilter().UserDefinedAttributeTypeNum(guidOfUserDefinedAttrib), nLocale).getValue(); //This long chain of methods retrieves the attribute value of the first array element which is currently undergoing comparison bUserdefAttrValue = b.ObjDef().Attribute(ArisData.ActiveFilter().UserDefinedAttributeTypeNum(guidOfUserDefinedAttrib), nLocale).getValue();//This long chain of methods retrieves the attribute value of the second array element which is currently undergoing comparison if(aUserdefAttrValue < bUserdefAttrValue){ //Now simply compare the two Strings. You might want to add .toLowerCase() or .toUpperCase() in the previous lines at the end if you want to compare strings that begin with a letter. Otherwise strings that begin with a capital letter will always be first before strings that start with a lowercase letter return -1; //sort a before b } else if (bUserdefAttrValue > aUserdefAttrValue){ return 1; //sort b before a } else { return 0; //sort a and b on the same level } }); //Here do something with the sortedObjOccs array }