rename column by position

3 posts / 0 new
Last post
mikew
Offline
Joined: 09/25/2019 - 08:25
rename column by position

Hi,
Is it possible to rename the column of a database based on its position rather than its name? For example, change the last column of a database to a standardised name.
I am looking for something similar to how you index by columns with a data.frame or matrix in R and Python. 
thanks,
Mike

klmi
Offline
Joined: 02/13/2019 - 08:41

Hi mikew,
you didn't post any code example so I guess that you are using  TableDef.GetField("FIELDNAME") to find the field by it's name. Instead of applying TableDef.GetField("FIELDNAME") you can try TableDef.GetFieldAt(index) to access the fields by index. To get the last column or the number of fields in you database IDEA contains TableDef.Count.

mikew
Offline
Joined: 09/25/2019 - 08:25

thanks, exactly what I was looking for!