Is there a way to import the records of a static entity (enumeration) with an excel sheet?

Hello,

Here is a post explaining a way to achieve this.

https://www.outsystems.com/forums/discussion/7851/re-import-static-entity-records/

Hope this is helpful!

Andres Moreno

Thanks, that has brought me close, although not complete.

I followed the procedure as explained in the other post, but got stuck because no records seemed to be imported.

However, when I deleted the excel in the Resources, and deleted the Structure as well as the Action, suddenly the records appeared, and I could convert the entity to a static one.

There is a warning, however, that keeps coming. It says:

"Database Integrity Suggestion. Unable to find record metadata for the database record with key '1' of the static entity 'Pitch'."

This message is then repeated 128 times, with the key number climbing up to 128 (the number of records that were imported).

Any clue how I can get rid of this message?

Solution

Hi Alcedo,


Doesn't that warning disappear after the second publish? I think that the missing metada may be "normal" on the publish that is doing the conversion, but I would expect it to disappear after that.


If it doesn't, a quick fix is for you to Copy/Paste your entity in the module, then delete the original one and rename it.

This will create a completely new static entity in the database with all the values that were already imported before.


Also as a general recommendation I suggest not using auto number integers as Id of static entities.

Since the process i described above will recreate the entity it's a good moment (after the paste and before publishing the module) to decide if there is another unique attribute already that can be used as Id. Usually there is a unique text field or even the numeric id that was imported already, but no longer needs to be auto number.


Regards,

João Rosado

Solution

João Rosado wrote:

Hi Alcedo,


Doesn't that warning disappear after the second publish? I think that the missing metada may be "normal" on the publish that is doing the conversion, but I would expect it to disappear after that.


If it doesn't, a quick fix is for you to Copy/Paste your entity in the module, then delete the original one and rename it.

This will create a completely new static entity in the database with all the values that were already imported before.


Also as a general recommendation I suggest not using auto number integers as Id of static entities.

Since the process i described above will recreate the entity it's a good moment (after the paste and before publishing the module) to decide if there is another unique attribute already that can be used as Id. Usually there is a unique text field or even the numeric id that was imported already, but no longer needs to be auto number.


Regards,

João Rosado

Hi João,

Great suggestion, the copy/paste works! This is the tric I was looking for, because it was clear to me that data, once entered, do not disappear when you try to overwrite them with a new excel import.

Changing the identifier to a non-autonumber field: I tried by setting another (unique) field to identifier, but it raised 128 errrors, because it inserted a new (empty) id field instead of using the assigned one (called "Midi"):


Do you know why?


Thanks anyway.

Regards, Alcedo

Yes, but looking at your data I really don't think that its a good idea to use the Midi as a Identifier since the "0" will be a problem. It would probably cause you problems later on trying to distinguish 0 from NullIdentifier().


Answering your question on why it gave the errors, you needed to delete the "Id" attribute after setting the "Midi" new one to identifier.


If it was me I would do the initial table and import from excel again to get a better entity definition, specially to get better names than "Record*" 

I would set the inicial table like this:

Id : Text

Midi : Integer

Frequency : Decimal

Notename : Text

Is_Active : Boolean


On the entity properties screen (the one in your screenshot) expand the "More options" and set:

"Identifier Attribute", "Label Attribute" and "Order by attribute" all to "Id".

"Is Active attribute" set to "Is_Active"


Then when importing the excel, instead of leaving the Id empty, fill it with something like "Midi_" + Midi

Also fill all the Is_Active attributes to true.


When doing the conversion after that, it will give you a way better result.


Regards,

João Rosado