3 posts / 0 new
Last post
Brian Element's picture
Brian Element
Joined: 07/11/2012 - 19:57

IDEA has 14 different field types.  To access it in the script you would use the field.type function which would return an integer indicating which field type it is.  I noticed something interesting about the field types, 4 of the types are for editable fields, so when you are creating the field you would use the editable field type but once they are created and you use IDEA to see what type of field it is IDEA views them as normal IDEA field types.  Something to remember if you are using any editable types in your script.

Here is a breakdown of the field types.


Constant Description  
WI_VIRT_CHAR Virtual Character 0
WI_VIRT_DATE Virtual Date 2
WI_VIRT_NUM Virtual Numeric 1
WI_VIRT_TIME Virtual Time 13
WI_BOOL Boolean 10
WI_MULTISTATE Multistate 9
WI_EDIT_CHAR Editable Character 7
WI_EDIT_DATE Editable Date 8
WI_EDIT_NUM Editable Numeric 6
WI_EDIT_TIME Editable Time 12
WI_DATE_FIELD Date Field 5
WI_CHAR_FIELD Character Field 3
WI_NUM_FIELD Numeric Field 4
WI_TIME_FIELD Time Field 11
Joined: 01/25/2019 - 08:32

Thank you, it was very useful to me.  Let me make a question, how to use IDEA @functions, like @date(), in python? eg: field.Equation = "@Date()"

Joined: 02/13/2019 - 08:41
import win32com.client as win32ComClient

if __name__ == "__main__":
        idea = win32ComClient.Dispatch(dispatch="Idea.IdeaClient")
        db = idea.CurrentDatabase()
        task = db.TableManagement()
        field = db.TableDef().NewField()
        field.Name = "DATE"
        field.Description = ""
        field.Type = 2 #constant "WI_VIRT_DATE" unknown in Python
        field.Equation = "@date()"

        db = None
        idea = None
        task = None
        field = None