Hi Stephen
Try this: (each subarray in a is composed of { Population, ID, Rank) }
a = { {7, 2, 0}, {3 ,1, 0}, {6, 4, 0}, {4,5, 0} , {4,8, 0}, {7, 6, 0} }
b = SortArray(a)
value = b[1][1]
i = 1
rank = 1
n = 1
while i < b.length do
while value = b[i][1] and i < b.length do
b[i][3] = rank
i = i + 1 end
rank = rank + 1
if i <= b.length then value = b[i][1]
end
ShowArray(b)
Populating the a array as well as getting the values for b to populate
your table with the ranks should be easy steps.
Cheers
Armando
sjones_sc wrote:
> I need to write code that will take a column of values, sort them, and fill
> another column with sequenced 'ranked' values. Now, the HARD part is that
> the regular method of SetRecordsValues with a sequence {1,1} of values isn't
> exactly accurate. And the counter=0, counter = counter + 1 loop is the same
> as the SetRecordsValues. The problem with those methods is this...if two
> consectutive records have the same value, they aren't ranked the same b/c it
> is a simple fill sequence method. So, for example, open a view and sort by
> population field, and if records 2 and 3 each have a value of 25000, record 2
> is ranked 2 and record 3 is ranked 3, where actually, they should both be
> ranked 2 (or 2.5). I have immersed myself in multiple array loops and have
> officially gone off the deep-end. Anybody have any ideas??
> Thanks in advance for any help.
>
> Stephen
>
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor --------------------~--> Get
> fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
> http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/C5grlB/TM
> --------------------------------------------------------------------~->
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/C5grlB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Maptitude/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/