# Sort numbers and return the lowest

**URL:** <https://forum.kirupa.com/t/sort-numbers-and-return-the-lowest/245805>\
**Category:** Uncategorized\
**Created:** [December 4, 2007, 12:13pm UTC](https://forum.kirupa.com/t/sort-numbers-and-return-the-lowest/245805 "2007-12-04T12:13:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![brndn](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@brndn](https://forum.kirupa.com/u/brndn)\
**Post date:** [December 4, 2007, 12:13pm UTC](https://forum.kirupa.com/t/sort-numbers-and-return-the-lowest/245805/1 "2007-12-04T12:13:20Z")

</div>

Hey there  
i am trying to all the numbers within a xml group. to find the lowest lunber out of the lot.

I am think of using something like  
Sort(results.data.shareOfTrade)

or is there some kind of method for returning the lowest numerical value like sort.toLowest();

this is in flex so there might be a method to do something like this. anyone.

if not I am thinking of creating a function to pass the values to.  
and compare each value to the lowest.  
if lower then that becomes the new lowest.

like

XmlLength = results.data.length  
for(i=0;i\<XmlLength; i++){  
if(lowest\<Newval){  
finalLeast = lowest;

}else{

finalLeast = Newval;

}  
return finalLeast;  
}

the only bad news is i need to pass 3 xml data feeds to it.  
results.data.share  
results.data.notrade  
results.data.fulltrade

and I need to return and different value per pass. I need to pass to the loop about 9 times.

ill have a think on it, but any epiphones would be well appriciated…

cheers
