Create Full-fledged Pages in an Instant
Create an Entity from an Excel File
This lesson is part of the Developer Online Class for OutSystems 9 course.
LEARN MORE

Transcript
in the next lessons we will create an application to manage Suppliers
will use some accelerators to scaffold the application fasten easy
we'll start by modeling entities and importing data for them
let's start by creating our web application
and will call its Suppliers and lets
add a new eSpace module to our application
first to model the entities in our application you know
that we need to go into the data tab and before we start
creating here the entities let me just show you the
Excel file with the data that we're going to import into our application
this is a Supplier list
and it has here a bunch of suppliers where we have
their name and email, a phone number
and address and a website and you notice here that
not all of this information is filled in for instance the phone number is not
present for this supplier
as well as the website OK?
so before I continue, I'll need to close the Excel file
and let me disclosed here, and now instead of creating the entity
and then bootstrapping the data, I'm going to use another option here
on the Entities folder, right-click I'm going to use this option here
import entities from Excel and
I will choose the suppliers Excel file that you just saw
and you'll notice that
a bunch of star started showing here
in our application and what just happened is that
this entity Supplier here was created
based on that Excel file and for
each column in the Excel file an attribute is created
that matches the top row of that column. The datatypes
and the mandatory property of these attributes are also inferred by the OutSystems
Platform so we have here
the name, the email
and you'll notice that the data types are inferred by the platform
the phone number, the address
and the website, and if you recall from data on the Excel file
the phone number and the website were not filled-in in all the rows
so this means that they are not mandatory in our
entity and the other attributes are
inferred as mandatory. Apart from all these attributes
the platform also creates an identifier for our entity
now besides this entity that was created
other objects were created in
in our application, so let's see what objects were created. In the logic
tab you'll notice that under the actions folder
we have an action and this
action is pretty much what we've seen in previous lessons
this is the action that bootstraps the data for this
entity and the data comes from this Excel file that we just saw
let me just drill down here on this action and you notice that
the logic that is here on this action this is not that complex logic
and basically what this action does that it retrieves the information from the Excel file
using the Excel to Record List tool
which is this tool here and its stores this information
in the database to accomplish this
the Excel file itself needs to be embedded as a resource
under the resources folder on the Data tab so
here on the Data tab under the resources folder
we will find our Excel file. Now
you've seen here the logic that creates these suppliers based on the data from
the Excel file
the question that remains open is but when does this logic
get executed and to answer that question I'll need to show you
another object that was created by this
action that we just did. Here under the
Processes tab you'll find a folder called Timers
and here you will find the BootstrapSupplier Timer
A Timer allow to execute logic asynchronously
on a specific schedule. In this case the Timer is
triggered when the application module is published. And you'll notice this
by this property here Schedule - When Publish
And the logic that the Timer
executes, is enclosed in this action that we're seeing here
the BootstrapSuppliers action the action that we have
actually opened here in our application
In the next lesson will create a list screen to show the data from this Excel file
And that's it