Identifier data type for  External Database
Application Type
Reactive

Hi all,

I used a MySQL database as external database for my app. 

It has two table, Province and Village.  Province has id as identifier, and additional information such as Name, Location... 

Because one Province can have many villages, so I want to have an one-to-many relationship between them by Province.Id and Village.ProvinceId.

I know that I can't do that with external database in my diagram. So I created a aggreate and made a join beetwen two sources for the add/edit villages screen manually.

Because I want to users choose Province.Name (not Province.id by typing in one input box) to assign Province.Id to Village.ProvinceId, and I made the dropbox. So the list is Provinces.List, the Option Text is Province.Name, the Option Value is Province.Id, etc...

But I don't know how to overcome the problem. That is Outstytems required the variable (here is Village.ProvinceId) is a Province Identifier. 

But I can't change the data type  of Village.ProvinceId into Province Identifier like with "internal" entities. 

So what I should do in this situation? 

Thanks for your help.


Solution

Simply while you are saving value ProvinceId  in village table. Just use IntegerToIdentifier() method.

Lets say ProvinceId is 5. Right now this 5 is integer. But before making entry into the Village table. pass value like IntegerToIdentifier(5) instead of only 5.


Yes. My problem is presenting options text extracted from a list (including some fields) which make sense to users in a form. Thanks.

Solution

I found. In Intergration Studio I can change the data type to any Entity Identifier. Thanks to Outsystems Team. 

If change of datatype is not possible in MySQL for you then, can use integer or LongInteger and use methods IntegerToIdentifier() according to your need.

Thank you. But I am confused a litte bit with "change of databse is not possible in MySql" (?).

 And how can use the method you mentioned.

Thanks again.

Solution

Simply while you are saving value ProvinceId  in village table. Just use IntegerToIdentifier() method.

Lets say ProvinceId is 5. Right now this 5 is integer. But before making entry into the Village table. pass value like IntegerToIdentifier(5) instead of only 5.


Yes. My problem is presenting options text extracted from a list (including some fields) which make sense to users in a form. Thanks.

Solution

I found. In Intergration Studio I can change the data type to any Entity Identifier. Thanks to Outsystems Team. 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.