Attribute or Data Type Conversion
(Created page with "Evolving from one data type to another is not automatically due to the side effects of conversions. Mdriven provides different options for converting data types, # Using FormerNames property setting. # Using a method. # Using derived attributes (Recommended). # Using SafeCast. === Important to know before performing a conversion === * Data conversions have to be done meticulously that as they can result in data loss. Backup your database before performing any conver...")
 
No edit summary
Line 1: Line 1:
Evolving from one data type to another is not automatically due to the side effects of conversions.  
Evolving from one data type to another is not automatically available in Mdriven due to the side effects of conversions.  


Mdriven provides different options for converting data types,
Mdriven provides different options for converting data types,
Line 13: Line 13:


=== Using FormerNames property setting ===
=== Using FormerNames property setting ===
- Set New Type on Attribute
This solutions involves renaming the attribute.


- The easiest way to use this is using the rename option
1. Set New Type on Attribute.


- Rename the attribute to a new name and make sure to check Set Former Name checkbox
2. Rename the attribute to a new name and make sure to check Set Former Name checkbox


   When you rename an attribute, the previous attribute will be dropped or destroyed and attribute with new name is created.
   When you rename an attribute, the previous attribute will be dropped or destroyed and attribute with new name is created.
Line 23: Line 23:
   Checking the Set Former Name checkbox will add the previous attribute name in the Database property setting FormerNames.
   Checking the Set Former Name checkbox will add the previous attribute name in the Database property setting FormerNames.


- Upload model
3. Upload model.


   MDriven evolver will try to transform to transfered and transform data from the old attribute to the new attribute.
MDriven evolver will try to transform and transfer the transformed data from the old attribute to the new attribute.


   After checking and making sure the data has been successfully transformed. rename the attribute to its previous name and
4. After checking and making sure the data has been successfully transformed, repeat step 2 and step 3 renaming the attribute to its previous name.  
 
   make sure to check Set Former Name checkbox. and upload the model
 
Conversions are not automatically available in mdriven


=== Using Method ===
=== Using Method ===
- Using a method can be more useful in scenarios where you want to be more explicit about your conversion or want to combine data of  
Using a method can be more useful in scenarios where you want to be more explicit about your conversion or want to combine data of two attributes into one.
 
   two attributes into one


- Start by adding a method to a class
1. Start by adding a method to a class.


- Goto method body and use EAL expressions for your transformation.
2. Go to method body and use [[Documentation:EAL – ExtendedActionLanguage.|EAL expressions]] for your transformation.


- Open debugger
3. While the TurnKey and Server applications are running, open debugger.


- Run method in Action mode for the instances you would like to peform transformations on
4. Run method in Action mode for the instances you would like to perform transformations on.


- Dont forget to save after executing the expression
5. Don't forget to save after executing the expression.


=== Using Derived Attributes (Recommended) ===
=== Using Derived Attributes (Recommended) ===
- Using derived attributes ensures there are no side effects on your data. With this option current data is retained and your to
Using derived attributes ensures there are no side effects on your data. With this option current data is retained and you can try other data conversions and transformations without affecting the data.  
 
   try other data conversions and transformations without affecting the data.


- You can use the new data attributes with the old data types incase you change your mind, just delete the new derived attribute  
You can use the new data attributes with the old data type attributes, incase you change your mind, just delete the new derived attribute and continue using your old data type attribute. 


   and continue using your old data type. Deleting a derived attribute will not have any effect on your data in the database.
Deleting a derived attribute will not have any effect on your data in the database.  


- Use derived attributes to also test out other transformations with out side effects.
Use derived attributes to also test out other transformations or combination of attributes with out side effects.


- Use derived attributes to test new types or other types - ensures that data is retained and new type is also available
Derived attributes ensures that current data is retained in  its state of truthfulness and new type is also available


- Derived attributes can also be used for complex transformations
Derived attributes can also be used for complex transformations.

Revision as of 16:16, 14 July 2024

Evolving from one data type to another is not automatically available in Mdriven due to the side effects of conversions.

Mdriven provides different options for converting data types,

  1. Using FormerNames property setting.
  2. Using a method.
  3. Using derived attributes (Recommended).
  4. Using SafeCast.

Important to know before performing a conversion

  • Data conversions have to be done meticulously that as they can result in data loss. Backup your database before performing any conversions.

Using FormerNames property setting

This solutions involves renaming the attribute.

1. Set New Type on Attribute.

2. Rename the attribute to a new name and make sure to check Set Former Name checkbox

   When you rename an attribute, the previous attribute will be dropped or destroyed and attribute with new name is created.

   Checking the Set Former Name checkbox will add the previous attribute name in the Database property setting FormerNames.

3. Upload model.

MDriven evolver will try to transform and transfer the transformed data from the old attribute to the new attribute.

4. After checking and making sure the data has been successfully transformed, repeat step 2 and step 3 renaming the attribute to its previous name.

Using Method

Using a method can be more useful in scenarios where you want to be more explicit about your conversion or want to combine data of two attributes into one.

1. Start by adding a method to a class.

2. Go to method body and use EAL expressions for your transformation.

3. While the TurnKey and Server applications are running, open debugger.

4. Run method in Action mode for the instances you would like to perform transformations on.

5. Don't forget to save after executing the expression.

Using Derived Attributes (Recommended)

Using derived attributes ensures there are no side effects on your data. With this option current data is retained and you can try other data conversions and transformations without affecting the data.

You can use the new data attributes with the old data type attributes, incase you change your mind, just delete the new derived attribute and continue using your old data type attribute.

Deleting a derived attribute will not have any effect on your data in the database.

Use derived attributes to also test out other transformations or combination of attributes with out side effects.

Derived attributes ensures that current data is retained in its state of truthfulness and new type is also available

Derived attributes can also be used for complex transformations.

This page was edited 52 days ago on 07/26/2024. What links here