FieldByNum usage lazarus / 16-Databases ---------------------------------------------------------------------- garydale · 2011-08-06 19:34 I'm trying to speed up part of a program and thought replacing "FieldByName" with "FieldByNum" could do that. That of course leads to the issue of determining the field number. At least if I can figure that out, I only need to find the field number once for each field - working on the assumption that a numeric lookup will be faster than a text search. Unfortunately reading the source code hasn't helped. Apart from finding an "IndexOf" procedure with no documented usage, I'm still in the dark. Pascal might be easier to read than many other languages but names and parameter types don't always make things obvious.  1) am I on the right track in trying to replace fieldbyname with fieldbynum? 2) does IndexOf('nameoffield') return a useful number for fieldbynum? ---------------------------------------------------------------------- Lacak2 · 2011-08-08 06:41 You can use:  i:=FieldByName('xxx').Index or variation with FindField('xxx') and then:  Fields //your FieldByNum() ---------------------------------------------------------------------- avra · 2011-08-08 07:38 If you are using "FieldByName" in a loop then it will be very slow. One cure for that can be to do it once before loop and assign it to some variables. Then use those variables in the loop.