This project is read-only.

Return index of Field by Name

Nov 22, 2011 at 1:18 AM

Hi all,

I'm using v4.8 Final and been trying to get the index of a field by using the column's name.

I've tried to use for example: Shpfile.FieldbyName("NAME") but it doesn't return the index. I would expect it to work so that I can use something like Shpfile.CellValue(Shpfile.FieldbyName("NAME"),Shpfile.Shape(i))

I need to use this because the shapefile's column order may vary from one file to another.


Nov 22, 2011 at 2:54 PM

You need to look at sf.Table.get_Field() or similar. I forgot the exact syntax.

It is in the Table class for sure.


Nov 24, 2011 at 5:56 AM

Thanks Paul,

Found it. It's .Table.FieldIndexByName("NAME"))