Customizing ID Table Database

Customizing ID Table Database

  

Can i do some customizing ID on my database? for example : i got 1 table named profile, and i need to combine 2 table to be a profile table 

id name = 1

id age = 1

id profile = id name + id age


can i do that thing?

f I understand your question correctly you want to create records in a third table and you want the ID of those records to be some sort of a composit of other two table's ID'd? Then I have to ask, do you really need to do this? why?

Solution

Hi,


imho you should have a simple Profile entity where you have 3 id's

Id

NameId (Foreign key)

AgeId (Foreign key)


where you also add a unique constrainst on NameId/AgeId, so you don't get doubles


Solution

Guilherme Dantas wrote:

f I understand your question correctly you want to create records in a third table and you want the ID of those records to be some sort of a composit of other two table's ID'd? Then I have to ask, do you really need to do this? why?


hello, yeah exactly what you said. i really need to this cos i need to combine a lot of ID from many table so i can build an identical id for a specific table. i cant really depend on this data model. honestly i really don't know how to use data model in Outsystems. :p

J. wrote:

Hi,


imho you should have a simple Profile entity where you have 3 id's

Id

NameId (Foreign key)

AgeId (Foreign key)


where you also add a unique constrainst on NameId/AgeId, so you don't get doubles



oh ty for your advice. appreciate it, but can you tell me the function of data model in Outsystems? can i really connecting a lot of tables in there?

So,


1- You have table A with id string ( you can change the Id type to text in the entity and then selecting Id and then type)

2- Table B and C with integer identifier.

3-Table A has attributes

   3.1- Id

   3.2- TableB.Id

   3.3- TableC.Id

4- You want to have table A be a concatenation of tableB.Id and tableC.Id.

    4.1 - example; tableB.Id = 12, TableC.Id= 14    TableA.Id with these two would be = 1214 as a string!


5- Create an action "ActionSave_A" that takes an input of type TableA record!

6- In ActionSave_A you will first have an assign, in that assign you do:

     TableA.Record.Id  =  IdentifierToText(TableB.Id) + Identifiertotext(TableC.Id)

7- Then you use the create action for the TableA with using as input the TableA.Record , which now has the Id equal to a concatenation.



Notes: 

1-You first need to create some records with TableB and TableC so that you can create Records in TableA using the Id's of records of those tables.

2- Take care of CreateUpdates, naturally, if you want consistency, then every time you update a TableA record then you have to check if the Id's of either of the TableB or tableC id's have been changed. You can delete the original record of tableA that had the Id's changed, and then create a new one.... This might get a bit more complex if TableA.Id's are used in other table, then you have to update those too, if you need help say so :).

Hope it helps