Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Minimum
Message
From
17/06/2014 13:24:29
 
 
To
17/06/2014 11:12:30
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01601946
Message ID:
01601984
Views:
55
fantastic mike - exactly what I was looking for - your cursor solution is bang on.
I was searching for the record number that contained the minimum value in string of fields - don't know how you figured that out from my posting but that hit the mark. thank you for the solution and patient explanation. much appreciated.

I have other applications for that so it will be useful.

k

>>
>>rn1 = 10
>>rn2 = 20
>>rn=min(rn1,rn2)
>>? rn
>>
>>rn gives the lowest value 10
>>how would I get rn to show 'rn1' instead - ie the name of the variable.
>>
>>thanks
>>
>>k
>
>>
>>rn1 = 10
>>rn2 = 20
>>rn=min(rn1,rn2)
>>? rn
>>
>>rn gives the lowest value 10
>>how would I get rn to show 'rn1' instead - ie the name of the variable.
>>
>>thanks
>>
>>k
>
>That begs the question what are you doing that for? To go through a list of items of any length and grab the minimum and then have a pointer to the item is a piece of cake.
>
>If you have an array with values
>
>
DIMENSION laList[2]
>laList[1]=10
>laList[2]=20
>lnMin=laList[1]
>lnPointer=1
>FOR X=2 TO ALEN(laList,1)
>  if laList[m.x] < lnMin
>    lnMin = laList[m.x]
>    lnPointer = m.x
>  endif
>ENDFOR
>
>?"the row with the minimum value is ",m.lnPointer
>
>With a cursor
>
>
calculate mix(field) to m.lnMin
>locate for field=m.lnMin
>lnPointer=recno()
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform