Name
global.SortTableArrayByLabel
Description
given an array of table names, return an array of the same table names sorted by the tables label used by scripts that have been implemented to work with the tableChoicesScript dictionary attribute on table_name fields
Script
gs.include("PrototypeServer");
var SortTableArrayByLabel = Class.create();
SortTableArrayByLabel.prototype = {
initialize : function() {
},
sortTablesByLabel: function(tables) {
var ts = [];
for (var i = 0; i < tables.length; i++) {
var t = [];
t.push(tables[i]);
t.push(GlideTableDescriptor.get(tables[i]).getLabel());
ts.push(t);
}
ts.sort(function(a,b) {return (a[1] < b[1]) ? -1 :((a[1] > b[1]) ? 1 : 0);});
var tss = [];
for (var j = 0; j < ts.length; j++) {
tss.push(ts[j][0]);
}
return tss;
},
type: "SetTables"
};
Sys ID
e2643f8bc0a800656a2525d07f11acaf