Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculate max() failed
Message
From
19/08/1999 14:44:33
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
19/08/1999 13:08:44
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00255384
Message ID:
00255451
Views:
15
>I used this:
>select mytable
>set order to mycode
>seek (mycode)
>myvar = ""
>Calculate max(myfield) to myvar rest while code = mycode for myFilterCondition
>
>It works fine ONLY if there are matching records to myFilterCondition.
>
>If no records within the scope match myFilterCondition, myvar returns a value from myfield on the next record out of the scope (this is, where code # mycode).
>
>I expected myvar to be blank when no matching records, even if it wasn´t blank before the calculation and much more if it was blanked as shown upthere.
>
>Is this a bug of vfp?. Does this work as I expected in other versions of Vfp? (I´m running VFP 6.0 version number 06.00.8167.00)

Cristobal,
I prefer :
select max(myField) from myTable ;
   where code = mycode and myFilterCondition ;
   into array aMyArray
myvar = iif(type("aMyArray[1]")="U","",aMyArray[1])
and this also have the advantage of not moving rec.pointer, no need to check table is open etc.
BTW It works as intended in VFP5.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform