Mass-populating entity attribute with IDs from another entity.

Mass-populating entity attribute with IDs from another entity.

  

(Using 10.0.715.0)

Hi

I'm recreating an existing SQL database in Outsystems, and it features a number of lookup tables. For context, I have a number of "Skills" which are split into several different "Skill Sets". 

In SQL, the "Skills" table lists all of the possible skills an employee can have, and a SkillSetID for each, dependent on the ID of the Skill Set this Skill lies in, from the SkillSet table.

Recreating this in Outsystems, I have a Skills entity, (ID and Skill Name) and a Skill Set entity (ID and Skill Set Name), but when bootstrapping the Skills data from Excel, the SkillSetID for each Skill is omitted, regardless of column name etc, and when viewing the data in the module, all SkillSetID entries in the Skills data are "0". (The 

How can I get the SkillSetID column in the Skills entity to be populated with the correct ID for the Skill set in which they are contained, whilst preserving the link?

Cheers


Solution

Hello Alasdair,

In the excel you are using, instead of the "id", use a new column withe the skill name.
It will not be in the structure (still ommited), but you can add it to the structure manually. Pay attention to attribute name, that should be the same as in the excel header column, the data type, that should be text, and the position in the structure, that should be the same as in the excel.

In the bootstrap, guarantee that the skill set is bootstraped first.
In the Skills, after the for each, but before the assign, add an Skill Set aggregate filtered by the name provided in the excel (structure). If you find it, assign manually the id found to the id of the record you will use to save the data to the database.

Hope this helps.

Cheers,
Eduardo Jauch

Solution

Hi Eduardo, thanks. 

(I think) I've done as you suggested, but don't understand how updating the action will actually affect my data. (Please see the screenshots attached). If now try to update my data, it just overwrites my changes to the server action for bootstrapping...? This takes me back to square one



Alasdair Inverarity wrote:

Hi Eduardo, thanks. 

(I think) I've done as you suggested, but don't understand how updating the action will actually affect my data. (Please see the screenshots attached). If now try to update my data, it just overwrites my changes to the server action for bootstrapping...? This takes me back to square one



Hi,

Sorry, it wont.
Usually we do this changes BEFORE doing the bootstrap itself. After the data being there, the bootstrap action will stop before performing any change, due the verification at the beginning of the action that exits the action if the entity you wants to add records is not empty.

You have two options:

1. Erase the data and do the bootstrap again.

2. Change your bootstrap so that it also finds the record in the database and UPDATES it, instead of creat a new one. This will require removing the verification at the beginning, change the code accordingly to find the records from the label in the excel, than find the set id from the other label, and than update the first with the id of the second. With this option you will have also to be carefull to disable the timer, and run it from Service Center, for example, to avoid running the update everytime you publish.

Sorry for not have being more clear first time.

Cheers,
Eduardo Jauch

Hi Eduardo, thanks for your help. I have this working now :)