Hi there,


I want to know if it's possible to use another field (not ID) as a primary key? Because I don't want to use the auto-number ID field as a primary key. I want to create a new UUID string and use it at a reference by a child table/entity.


My use case is:

- Entity A has UUID for each record.

- Entity B refers to the UUID of Entity A as a foreign key.


The reason why I want this is because I want to store all data in Local Storage first, then sync them to the Server. The automatically generated ID is not working in this case, because the IDs are different in Local Storage and Server. So, I want to use UUID as a primary key to use in both the Server and Local Storage.


Any ideas for achieving this? Thanks in advance!


Solution

Hi,

If you double click on your entity, you can change it's identifier atribute on more options.

It's probably a good idea to also index the field as unique.

Solution

OutSystems automatically takes care of the autogenerated ids while doing sync. I am assuming you have already goen through the mobile app development course for basic understanding of local storage. Along with this you cna also go through offline data sync documentation on this link: https://success.outsystems.com/Documentation/11/Developing_an_Application/Use_Data/Offline/Implementing_Offline_Sync