# Creating a user type within ERD diagram

**URL:** <https://forums.visual-paradigm.com/t/creating-a-user-type-within-erd-diagram/17329>\
**Category:** Plug-in & Open API\
**Tags:** erd\
**Created:** [December 31, 2021, 2:57pm UTC](https://forums.visual-paradigm.com/t/creating-a-user-type-within-erd-diagram/17329 "2021-12-31T14:57:14Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![GregS](https://avatars.discourse-cdn.com/v2/letter/g/bc79bd/32.png) [@GregS](https://forums.visual-paradigm.com/u/GregS)\
**Post date:** [December 31, 2021, 2:57pm UTC](https://forums.visual-paradigm.com/t/creating-a-user-type-within-erd-diagram/17329/1 "2021-12-31T14:57:14Z")

</div>

Festive greetings!

Currently we are using an ERD diagram to model a table within Cloud Spanner however VP doesn’t support the required data types within a given ERD table; therefore we thought about using the User Type field to overcome this problem.

To automate this process, I have created a plugin that takes a selected table in an ERD and maps the data type from MySQL to a Cloud Spanner data type equivalent. eg; int = INT64

Currently I can iterate over all the tables in a given ERD diagram, iterate over each column and extract certain properties eg;

```auto
IDiagramElement[] els = diag.getSelectedDiagramElement("DBTable");

IDBTable table = null;
for (IDiagramElement el : els) {
	try {
		table = (IDBTable) el.getModelElement();

		IDBColumn[] columns = table.toDBColumnArray();

		for (IDBColumn col : columns) {
			System.out.println(col.getName() + " ,type: " + col.getType() + ", " + col.getTypeInText());

			IDBColumnUserType colUserType = null;
			if (col.toUserTypeArray().length > 0) {
                //if user type already exists, print out the user type
                System.out.println(col.getUserTypeByIndex(0).getType());
            } else { 
               if (col.getType() == 9) { // int
                     //I want to set the user type here
	                //eg; colUserType.setType("INT64"); 
	            }

               // col.addUserType(colUserType); ?
           }
     } catch (Error err) {}
}

```

However I can’t quite figure out how to create a new IDBColumnUserType instance.

Any help is much appreciated.

---

<div class="post-metadata">

**Author:** ![Jick](https://avatars.discourse-cdn.com/v2/letter/j/ea666f/32.png) [@Jick](https://forums.visual-paradigm.com/u/Jick)\
**Post date:** [January 3, 2022, 4:12am UTC](https://forums.visual-paradigm.com/t/creating-a-user-type-within-erd-diagram/17329/2 "2022-01-03T04:12:48Z")

</div>

Hi GregS,

Thank you for your post. I have forwarded your inquiry to our team for further studying. When there is any news, I will let you know.

Best regards,  
Jick Yeung

---

<div class="post-metadata">

**Author:** ![GregS](https://avatars.discourse-cdn.com/v2/letter/g/bc79bd/32.png) [@GregS](https://forums.visual-paradigm.com/u/GregS)\
**Post date:** [January 17, 2022, 12:03pm UTC](https://forums.visual-paradigm.com/t/creating-a-user-type-within-erd-diagram/17329/3 "2022-01-17T12:03:19Z")

</div>

Hey @Jick, is there any update?

---

<div class="post-metadata">

**Author:** ![Jick](https://avatars.discourse-cdn.com/v2/letter/j/ea666f/32.png) [@Jick](https://forums.visual-paradigm.com/u/Jick)\
**Post date:** [January 18, 2022, 9:43am UTC](https://forums.visual-paradigm.com/t/creating-a-user-type-within-erd-diagram/17329/4 "2022-01-18T09:43:30Z")

</div>

Hi GregS,

Sorry for being late.

IModelElementFactory.instance().createDBColumnUserType()  
is the method to use to create a user type, but we are asking our team to provide more information about how to use the user type being created. We will come back to you when there is any news. Meanwhile, I will remind our teammates about your case.

Best regards,  
Jick Yeung

---

<div class="post-metadata">

**Author:** ![Jick](https://avatars.discourse-cdn.com/v2/letter/j/ea666f/32.png) [@Jick](https://forums.visual-paradigm.com/u/Jick)\
**Post date:** [January 19, 2022, 11:01am UTC](https://forums.visual-paradigm.com/t/creating-a-user-type-within-erd-diagram/17329/5 "2022-01-19T11:01:38Z")

</div>

Hi GregS,

To support your need, we introduced a new method. Please update to the latest patch build and try using the call below:  
IDBColumn.setUserType(string)

The following article shows you how to update:

> **[Update Visual Paradigm to Latest Patch - Visual Paradigm Know-how](https://knowhow.visual-paradigm.com/technical-support/update-to-patch/)**
>
> Upon receiving a problem report or request of enhancement, we do our best to make the necessary changes. You will then be suggested to update your Visual Paradigm installation to the patch release, in which the fix or enhancement has been made. In...

Best regards,  
Jick Yeung

---

<div class="post-metadata">

**Author:** ![GregS](https://avatars.discourse-cdn.com/v2/letter/g/bc79bd/32.png) [@GregS](https://forums.visual-paradigm.com/u/GregS)\
**Post date:** [January 21, 2022, 1:02pm UTC](https://forums.visual-paradigm.com/t/creating-a-user-type-within-erd-diagram/17329/6 "2022-01-21T13:02:14Z")

</div>

Hi @Jick ,

Thanks for responding! Has this patch update been released for v16.1? I have tried to update but it says Im currently running the latest patch build. I’m currently running build: 20220101

---

<div class="post-metadata">

**Author:** ![Jick](https://avatars.discourse-cdn.com/v2/letter/j/ea666f/32.png) [@Jick](https://forums.visual-paradigm.com/u/Jick)\
**Post date:** [January 24, 2022, 3:28am UTC](https://forums.visual-paradigm.com/t/creating-a-user-type-within-erd-diagram/17329/7 "2022-01-24T03:28:06Z")

</div>

Hi GregS,

The update was made to version 16.3, the latest version, only. I will ask our developers to review if we can support it in 16.1 as well.

Best regards,  
Jick Yeung

---

<div class="post-metadata">

**Author:** ![Jick](https://avatars.discourse-cdn.com/v2/letter/j/ea666f/32.png) [@Jick](https://forums.visual-paradigm.com/u/Jick)\
**Post date:** [February 4, 2022, 7:44am UTC](https://forums.visual-paradigm.com/t/creating-a-user-type-within-erd-diagram/17329/8 "2022-02-04T07:44:12Z")

</div>

Hi GregS,

We have made the change available in version 16.1. You can obtain it by updating your installation to the latest patch build (16\_1\_20220110ab or newer).

Best regards,  
Jick Yeung

---

<div class="post-metadata">

**Author:** ![GregS](https://avatars.discourse-cdn.com/v2/letter/g/bc79bd/32.png) [@GregS](https://forums.visual-paradigm.com/u/GregS)\
**Post date:** [February 8, 2022, 3:38pm UTC](https://forums.visual-paradigm.com/t/creating-a-user-type-within-erd-diagram/17329/9 "2022-02-08T15:38:56Z")

</div>

Thanks @Jick, that did the trick! 😃

---

<div class="post-metadata">

**Author:** ![Jick](https://avatars.discourse-cdn.com/v2/letter/j/ea666f/32.png) [@Jick](https://forums.visual-paradigm.com/u/Jick)\
**Post date:** [February 10, 2022, 3:19am UTC](https://forums.visual-paradigm.com/t/creating-a-user-type-within-erd-diagram/17329/10 "2022-02-10T03:19:23Z")

</div>

You are welcome. 🙂
