When building processes in Bizagi Studio, there are scenarios where you need to change the attribute type. For example, changing a numeric type like Integer, into a String type attribute. Bizagi lets you change attribute types only if the change meets some considerations. This article explains the algorithm that Bizagi follows to let a user change an attribute type.
When can you change an attribute type
When you are editing attributes of an entity, from the expert view, or a data model, you can select or change the attribute type.
However, Bizagi first analyzes when you try to change an attribute type from Bizagi Studio, looking for dependencies and existing values. Depending on this analysis, Bizagi can either let you change the value based on the following algorithm.
The algorithm reviews first if the attribute has dependencies or entity values:
Dependency: means that it is used in a rule or form in a process.
Entity values: This means that the there is a value in the attribute within the table. A value can be a business data or metadata used for internal purposes in Bizagi. These entity values can be created in three ways:
From Bizagi Studio
From the development environment (for entities managed in development)
It is important understanding that although an attribute could not have business data stored, but still have metadata or be associated with metadata in other tables. This is considered as an entity value. So, an attribute can have business data and entity values.
If the attribute has dependencies or entity values
When the attribute meets this condition, Bizagi runs a data validation table. This table compares the original attribute type against the type chosen by the user.
Data validation table
* Note: You can change the string length if the new length is greater or equal than the previous length. See changing attributes into string type.
If the value in the table is YES, it means that the change is executed without any further validations. On the other hand, those changes with a NO means that the column in the table must be rebuilt and the data is deleted. In this scenario Bizagi displays the following warning message:
If the user confirms, the type change is executed.
Changing the length
When you change the length of an attribute, Bizagi validates the values depending on the entity type.
Parameter entities managed in the development environment
After you change the length of an attribute in the entity wizard, when you click next, Bizagi validates that existing values meet this new length. If there are values with a greater length, Bizagi displays a warning message because the column must be rebuilt, and existing data is lost.
Parameter entities managed in the production environment o master entities
For these entities, and in case you change the length for a value less than the existing, Bizagi must rebuild the column, and all data is lost after the deployment. Additionally, Bizagi validates during the deployment that existing values meet this new length.
If the attribute has NO dependencies or entity values
If the attribute to be changed has no dependencies nor entity values, Bizagi runs the transparency table. This table validates if the change is possible.
If the value in table is YES, it means that the change is executed without any further validations. On the other hand, those changes with a NO means that it is not possible to change the type Bizagi displays an alert to the user.
Changing attributes into string type
When you change an attribute into a string type, Bizagi validates the length based on the transparency table values. If you set a length less than the permitted, Bizagi displays a warning message after you click Finish.
This validation also occurs when you have master or parameter entities managed in the production environment, and you deploy a change of the length of an attribute. If existing values