Hi,

I'm new to Outsystems - working through my first application. I can see that I can easily add example data that's useful for design time - however at runtime the data comes from the application database.

Is there an easy way to seed data manually (without having to write C# code using the API)? With a direct Sql Server connection I'd use something like Management Studio ...

Best

Eduard

I can see that the Excel bootstrapping would solve the problem - however how would you model 1:n relationships?

My initial attempt failed through data integrity issues (even though the Ids seem to be correct ...

Hi Eduard,

That kind of bootstrapping you need to implement it yourself. You can start by the the one the application creates and modify it a bit. In this other post you have a possible solution.

Regards,

Marcelo

Hi Eduard,

I was battling the same issue when I started importing data. The bootstrapping functionality is a great starting point, but when it comes to handling things like foreign keys we need to massage tbithe automatically generated functions a bit. Depending on how much data you wish to bootstrap there are a few different approaches.

The easiest is that you assign the ID to be used as FK yourself and then also populate the FK in the child table. Then you drag these tables to Service Studio to have the entities bootstrapped. In the automatically created entities there will be an automatically generated ID attribute and the one you bootstrapped, renamed to ID if you called it ID initially.

Then you will need to set the FK attribute(s) in the entities, but keep them as integers in the corresponding structures. In the Server Action you will have to use the IntegertoIdentifier() function on the integers to convert them from integers to attribute identifiers.

I have created a small example of how I go about it (there might be much better methods out there, but this one worked for me to get some test data in):

I created a new WebApp and used the Create entities from Excel to load the attached Excel file. Then I did the following:

1. Made Hand.ID2 identifying attribute

2. Removed system generated ID from Hand Entity

3. Renamed Hand.ID2 to Hand.ID

4. Changed Finger.HandID data type from Int to Hand Identifier

5. Changed Assign in BootstrapFinger Server action so that HandID is assigned as Integertoidentifier(HandID). This way OS knows that I want the number to refer to an entity

6. Changed priority of Hand Bootstrap timer to High so that it loads before the Finger Entity

7. Made a small screen to view the data

In addition, you might want to turn AutoNumer on for Hand.ID if you wish to have OS generate the keys.

In the attached .oml you have the result. You can try to take the Excel file in the resources and recreate the process yourself.

If no data shows up in your tables, then something failed. Any errors happening in the bootstrap will not be visible in the deployment feedback. If you go to ServiceCenter>Monitoring>Errors you can find what went wrong. Zou can access service center from Studio menu Module>Module management...

I didn't know that initially making me trying all possible things to get my uploads to work :)

I hope this explanation will help you! 

Perfect - thank you Mattias!