# Synopsis

PDX_MSGT gdx_EntitySetUserAttribute2(long option, MDA_PTR gdx_entity_ptr, char *attribute_name, int attribute_type, char *attribute_description, MDA_COUNT nfields, char *field_names[], char field_types[], GDX_USER_ATTRIBUTE_UNION field_values[], MDA_PTR orig_db_ptr, int gdx_model, MDA_PTR *gdx_user_attribute_ptr)

# Purpose

Set the user attribute.

# Description

Set the user attribute for the specified entity. First, the user attribute will be defined using gdx_UserAttributeDefine. Next, the user attribute will be created using gdx_UserAttributeCreate. Last, the user attribute will be attached to the specified entity using gdx_UserAttributeAttach.

# Input

## option

Not used

## gdx_entity_ptr

Database pointer of entity to set user attributes

## attribute_name

Name of user attribue

## attribute_type

Type of attribute (see gdx_structs.h for enumeration values)

## attribute_description

Description of attribute

## nfields

Number of fields for this attribute

## field_names

Array of field names for this attribute

## field_types

Array of field types for this attribute

## field_values

Array of field values for this attribute

## orig_db_ptr

Original database pointer or MDA_NULL_PTR

## gdx_model

GDX model

# Output

## gdx_user_attribute_ptr

Database pointer of created user attribute

# Return

          GDX_NOERR
          GDX_INVALID_USER_ATTRIBUTE
          GDX_INVALID_FIELD_TYPE
          GDX_DUPLICATE_USER_ATTRIBUTE
          GDX_USER_ATTRIBUTE_NOT_DEFINED
          GDX_INVALID_DBPTR
          GDX_NO_CROSS_MODEL_ASSOCIATIONS
          .fi