HP Quality Center field names

前端 未结 2 772
面向向阳花
面向向阳花 2020-12-22 09:51

I am interacting with HP QC using python and referring to HP ALM OTA documentation. What I need is to access fields in different places (particularly now I am trying to acce

2条回答
  •  温柔的废话
    2020-12-22 10:18

    When you get an entity field value, the field must be the underlying database column name for that entity. You can discover this using the project customization UI in HP ALM: select project entities then explore the system or user fields. Beware that the Design Step says the column name begins ST_... it doesn't. It's actually DS_...

    You can also get this information programmatically. Given a factory instance use the equivalent of:

    private void ExploreFactoryFieldDefinitions(IBaseFactory factory)
        {
            List fields = factory.Fields;
    
            foreach (TDField field in fields)
            {
                FieldProperty field_property = (FieldProperty)field.Property;
    
                if (field_property.IsRequired)
                {
                    Log(String.Format("User Label: {0}\n", field_property.UserLabel));
                    Log(String.Format("User Column Type: {0}\n", field_property.UserColumnType));
                    Log(String.Format("DB Column Name: {0}\n", field_property.DBColumnName));
                    Log(String.Format("DB Column Type: {0}\n", field_property.DBColumnType));
                    Log(String.Format("DB Table Name: {0}\n", field_property.DBTableName));
                }
            }
        }
    

    field_property.UserLabel gives you the user friendly field name. field_property.DBColumn name gives you the database column name that should be used with entity[field_name].

    BTW - don't forget to call entity.Post() to have your changes saved. When working with a versioned project you have a few more hoops to jump through too. Good luck!

提交回复
热议问题