I am trying to return only unique values and then sort them in ascending order using Query Builder for SFV1 1.3. I have tried to adapt some codes that were published in the old forums, but nothing has worked. Has anybody implemented this in there own project? Any help would be appreciated.
/* private function onFieldValuesRereivalsuccess(obj:Object):void{
mqbMessage = "Values has been retreived."
CursorManager.removeBusyCursor();
var fset:FeatureSet = obj as FeatureSet;
mqbMessage = "";
mFldValues = fset.features;
}
*/
private function onFieldValuesRereivalsuccess(obj:Object):void
{
mqbMessage = "Values have been retreived."
CursorManager.removeBusyCursor();
var fset:FeatureSet = obj as FeatureSet;
mqbMessage = "";
//use the uniquearray function to get a unique list.
mFldValues = uniqueArray(fset.features);
}
private function uniqueArray(a:Array) : Array
{
var unique : Array = new Array();
var contains : Boolean;
for( var i:Number = 0; i<a.length; i++ )
{
contains = false;
for (var j:Number = 0; j<unique.length; j++)
{
if (a == unique) contains = true;
}
if (!contains)
{
if (a != "")
{
unique.push(a);
}
}
}
return unique;
}
Jason