Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
FIELD() Function
Message
De
30/03/2004 10:29:23
 
 
À
29/03/2004 17:39:26
Elyse Pomerantz
Dynamic Data Concepts, Inc.
Brooklyn, New York, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00890059
Message ID:
00890804
Vues:
25
Thanks for bringing this to our attention.

This is a very strange one. It looks like a bug to me, and I submitted it for you. You can work around it by wrapping INT() around the AT() call.
lcField=FIELD(INT(AT("2",lcFldState,1))) 
What is really strange is subsequent calls also return the caption, even if you pass a number. This demonstrates:
clear 
close data all
erase testdb.dbc
erase testdb.dc?
erase testtab1.dbf
CREATE DATABASE testdb
create table testtab1 (f1 i, f2Name C(5)) 
=DBSetProp('testtab1.f2Name',"FIELD","Caption",'F2Caption')
?FIELD(2) && gives fieldname
?FIELD(AT("2",'12',1))  && gives caption, wrap with int() to workaround
?FIELD(2)  && gives caption unless you comment out or fix above line
?FIELD(Int(2)) && gives fieldname
return 
Passing a UDF rather than AT() works OK also.

>>>I just upgraded to VFP8 and I seem to have found another problem. There is a new parameter (nFlags) for the FIELD function that determines whether the field name or caption is returned. From what I see, it looks like the default is to return the caption, which is different than VFP7 and my code is crashing. This doesn't make sense - can anyone explain it?
>>
>>By default (w/o third parameter) the FIELD() function returns field name. Can you provide more details?
>
>My code looks like this:
>lcFldState=SUBSTR(GETFLDSTATE(-1),2)
>lcField=FIELD(AT("2",lcFldState,1)) (where AT("2",lcFldState,1) returns 42)
>
>I recompiled everything in VFP8. But when I step through the program, the value of lcField is the field's caption, not its name.
Jim Saunders
Microsoft
This posting is provided “AS IS”, with no warranties, and confers no rights.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform