Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
FIELD( ) Function - NOT!
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00316885
Message ID:
00317367
Vues:
15
>Is there a command the returns the opposite result of FIELD() Function? Because FIELD() returns the name of a field, referenced by number, in a table.
>
>I am looking for a function that returns the number of a field, referenced by name, in a table. Any such thing?
>
>The reason is that I have a group of 40 fields in the middle of my table and I have to check them all for a certain value. But I want to start checking at say field #30 and check until I get to field #70 for a common value. All fields are character 1.
>
>I figure if I determine the starting field number, I can loop through the fields until I reach the ending field number. And if I do the loop based upon field numbers, I would not care if additional fields were ever added in between the exisiting fields as long as they were Char 1 and used for the same purpose as the other 40 fields surrounding them.
>
>What do you think? Thanks for a clue.

No doubt you've been deluged but I have had this in use for some time...
function FieldNum
parameter tcfieldName
* Locates the field number - usually needed after scattering to an array.
* returns 0 if not found
local ii, cFieldName
cfieldName= upper(m.tcfieldName)
for m.ii= 1 to fcount()
	if field(m.ii) == m.cfieldName
		return m.ii
	endif
endfor
return 0
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform