This code sorts on group name.
It first captures the dataset values in a separate array,
which is then sorted before sent to the global.
Bit of a workaround.
I'll ask dev team if they can add a sort method to the Dataset object
myDataset.sort(columnName/Nr);
- Code: Select all
var Groups = security.getGroups();
var groupsArray = new Array()
globals.myGlobal = "GROUPNAME\tID\n"; \\backslash t stands for TAB
for ( var i = 1 ; i <= Groups.getMaxRowIndex() ; i++ )
{
//capture values in array
groupsArray[i-1] = Groups.getValue(i, 2) +"\t"+Groups.getValue(i, 1);
}
groupsArray.sort(); //sort the array
//loop through the array and fill the global
for ( var i = 0 ; i < groupsArray.length ; i++ )
{
globals.myGlobal += groupsArray[i]+"\n";
}