Mapping of column and attribute
Each attribute extended or defined for an enterprise is stored in the YFS_ENTITY_CUSTOM_ATTRIBUTE table along with the column name to which the attribute is mapped. The extended entities have corresponding hang off tables with predefined number of columns. The manageEntityCustomAttribute API is used to manage custom attributes for document type and entity.
Number of columns for a given entity and document type are predefined for an enterprise.
- DATE : 10 columns
- INTEGER : 10 columns
- DECIMAL : 10 columns
- TEXT : 20 columns
- BOOLEAN : 10 columns
The first five columns are indexed. The indexed columns are used for searchable attributes. The rest of the columns are used for non-searchable attributes.
When a new attribute is created, it is mapped to the first available column for that entity and document type. A searchable attribute is mapped to the first column of the five indexed columns. A non-searchable attribute is mapped to the first available column after the five indexed columns, if it does not exceed the maximum number of columns defined for the entity and document type.
Each attribute mapped to a column can have one of the following statuses:
- PENDING: Mapped to a column but cannot store transaction data
- ACTIVE: Ready to store or already contains transaction data
- INACTIVE: Unused attribute, does not contain any transaction data,
- DELETED: Deleted attribute which sets the mapped column free.
A new attribute is mapped to an available column with the status "PENDING". Pending attributes must be activated to store transaction data. Activation of attributes is done by the manageEntityCustomAttribute API. When an extended "ACTIVE" attribute is no longer used by the enterprise, it is marked as "INACTIVE". When "PENDING" attributes are deactivated, the status of the attributes is marked as "DELETED".
Attributes can be mapped to "DELETED" columns but cannot be mapped to "INACTIVE" columns. "INACTIVE" columns must be deleted before reusing them for mapping other attributes. An agent YSCRecycleEntityAttributeAgent is used to delete the "INACTIVE" columns for the entity and document type combination of an enterprise.
Here is an example of how the mapping logic works:
A non-searchable text attribute My_order_type must be added for an entity, Sales Order. Maximum number of defined columns for this entity is 20.
The following is the mapping of attribute and the columns:
The new attribute, "My_order_type" is mapped to the first available column of the non-indexed columns, namely, Column6, after the five indexed columns, since it does not exceed the maximum number of columns defined for that entity (20).
When the maximum number of columns defined for an entity and document type is reached (that is, all the columns are mapped to attributes), the manageEntityCustomAttribute API looks for the columns marked as "Deleted". For example, if a predefined number of columns for an entity and document type is 20, and, a new attribute (21) must be inserted, the API looks for a column with the status "Deleted" to insert the new attribute.