on 10-14-2015 4:45 AM
Hi,
I'm trying to change data type of a foreign key if it's parent attribute is defined with serial data type in LDM.
I have created an extension , added a metaclass - 'Relationship' to it and then, added an event handler - 'Initialize' under 'Relationship' metaclass.
However, I can't figure how do I access ParentAttribute and ChildAttribute for a relationship for which I have created 'Initialize' event handler.
I'm new to PD and vbscript. So, I'm still trying to figure out how to use PD metamodel. Any kind of help is greatly appreciated. Thanks !
Regards,
Arvin
If you open a relationship's property, you can see Joins tab.
It has mapping information about parent attribute and child attribute.
We can use this mapping to automate FK data type change.
The algorithm is that if parent attribute's data type is Serial, then change data type
from integer to Long integer in corresponding child attribute.
Here is an example:
Execute the following code. It reset customerID in businessOwner to Long integer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good Afternoon Philip,
Thank you so much for your help. I created an extension, added a 'model' metaclass and created an event handler 'OnModelSave', added your code sample there which will execute this script automatically everytime I save my model.
This is a work around for my problem and works perfectly fine. However, I was trying to change data type as soon as I create the reference. I guess I have to set up 'data type' at reference/relationship creation time and create reference with childattribute with datatype as long interger if parentattribute's datatype is 'serial'.
Thanks once again !
~Arvin
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.