0% found this document useful (0 votes)
34 views29 pages

Documento 5 de Gonzalo

Uploaded by

yarlei.luna117
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views29 pages

Documento 5 de Gonzalo

Uploaded by

yarlei.luna117
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ENGLISH

Learning Objectives
By the end of this module, you will be able to:

• Extend your app's Domain Model

• Explain the relation between the Domain Model and the Database

• Apply associations in the domain model

• Use associations in parameters

• Use Reference Selectors on a page to set associations between existing objects

• Create a training events page and add data from the home page

• Identify when to use information entities and extend the domain model

• Recognize when nested data is necessary and use it to create a page


PreviousNext
Scheduling Training Events
Congratulations! You have completed your first user story. Awesome job, you're really starting
to get the hang of this!

Jimmy is quite pleased with the work you have done. He can start adding his data to the
system, which is really helpful for LearnNow. Let's have a look at how your data is structured
so far! To do this, we will have a look at the Domain Model.

Extending the Domain Model

The next feature that would be useful for Jimmy is the capability to schedule training events, as
detailed in his next user story: As an administrator, I want to be able to schedule a training
event at any time, so that the teachers can see their schedule, even from their phone.
With this feature, Jimmy can schedule trainings in the app, and the teachers can see when and
where they have to host a course.

The training events are a new piece of data. For it to be dynamic, it needs to be in the domain
model. Adding new entities or attributes to the domain model is something we call extending
the domain model. This will cause your database to change, but Mendix handles all of that for
you.

The Database

The structure of the domain model determines what the database will look like. Each entity will
become a database table, and each attribute will become a column in the database. Every
object you store in the database (for example, a course) becomes a row in the corresponding
database table. This also means that if something is not in the domain model, you also can't
add that information to the database.
This is what the database table for the Course entity looks like:

You see that ID column? That is not an attribute. So how did it end up in the database table?
This is something Mendix does automatically for you, because every object always needs a
unique identifier (an ID) so that the system knows which object it is. Even if you create two
identical objects with identical attribute values, they will still have two unique ID numbers and
be treated as two different objects.

You can change the domain model as often as you like, and the database will synchronize
when you run the app again. Also, when you change the name of an entity or attribute, your
app will still work immediately, because Mendix Studio Pro will automatically apply these
changes everywhere.

PreviousNext

Add a New Entity to the Domain Model


In this assignment, you are going to enable Jimmy to schedule training events in his app!

1. Go to the Developer Portal and set the following story to In Progress: "As an
administrator, I want to be able to schedule a training event at any time, so that the
teachers can see their schedule even from their phone."

Jimmy added the following description to the story: "When scheduling a training event, a
location and course will need to be selected along with which teacher is going to host the
event. This way, the teacher can see which course they will have to teach and where. I should
also be able to select a start and end date for the course, so the teachers can see on which
days the course will occur."

2. Open the domain model and add a new entity called TrainingEvent. Use PascalCase
for the name, and remember that entity names should always be singular!

Jimmy said that he wants a training event to have a start date and an end date.

3. Add two attributes to the TrainingEvent entity: StartDate and EndDate. You can
probably guess which attribute type this entity should have: Date and Time!

Excellent! You have added a new entity to your domain model. Your domain model should now
look like this:

You might be wondering: Why does the TrainingEvent entity only have two attributes?
Shouldn't it include location information too? The answer is that we already have that sort of
information stored in the other entities. We just have to connect TrainingEvent to them using
Associations.
PreviousNext
Associations in the Domain Model
In the Domain Model, Entities can interact with one another via Associations. They look like
arrows between Entities. For instance, you need to be able to store in the system what course
will be given, where it will be hosted, who will teach it, and when it will happen.

The way Jimmy runs things, a training event will always be for only one course, at one location,
and hosted by one teacher. If you think about it from the other direction, all of those things will
be reused for multiple training events. Over time, a course will be scheduled more than once,
locations will be used more than once, and teachers will host many training events.

For each association that you add to your domain model, a new database table will be created.
This table will store the ID's of objects connected to each other. Just like Entities, remember
that an Association is the blueprint. The objects themselves must then be associated to each
other and their IDs stored in the table. Making an association in the domain model does not
mean that all Objects involved will be associated with each other. It just means the possibility
now exists to do so.

In Mendix Studio Pro, you can choose between three types of associations, which we are
going to explain by using football as an example. (American or soccer, your choice!) In football,
you have teams, players, stadiums, and leagues. The possible associations are described
below.

One-to-Many Association (1–*)

This is the most commonly used association. In the example, this is the association between a
player and a team. One player always plays for one specific team, but a team has multiple
players.

One-to-One Association (1–1)

This is the association where two objects can only be associated to each other and not to any
other objects at the same time. In the football example, this is shown in the association
between a team and a stadium. A team can have only one home stadium, and a stadium can
have only one home team. Their mascot is also in a one-to-one association.

Reference Set (* – *)

This is also called a many-to-many association. In the case of the football example, a league is
played by many teams, but a team can also compete in multiple leagues.

Let's take another look at the description Jimmy added to the user story: "When scheduling a
training event, a location and course will need to be selected along with which teacher is
going to host the event."
Before you can start thinking about signing up trainees, you first need to be able to add training
events to your schedule. So, for this user story, you will focus on that functionality, and in the
next user story, you will look into adding registrations to the training events.

PreviousNext

Add Associations
Let's put this into practice! The training event needs to have a connection to a course, location,
and trainer. This way, you can store in the system what course will be given, where it will be
hosted, and who will teach it.

1. Hover your mouse over the TrainingEvent entity. Click on the white circle that appears
on the border of the entity and drag a new association to the Course entity. The
association will be created as a one-to-many association by default. To change the
association type, just double click in the association and select a different type.

Notice associations have names too! The name of this association is TrainingEvent_Course.
This is the naming convention for associations: Entity1_Entity2. You can make the
association name more descriptive if you need to distinguish between two or more similar
associations, but the underscore that shows where one entity ends and the other begins is
important. In simpler apps, the default names are best.

2. Go ahead and create all the associations according to the description that Jimmy
provided. Make sure to rearrange your domain model (if necessary), so that all the
association labels are easy to read.

When finished, you should see this. This part of the app is important because everything else
you do from now on will be based on it, so make sure you have everything right:

Tip: Did you accidentally create the association in the wrong direction? No worries, you can
just delete it and recreate it in the other direction.

PreviousNext
Create Training Event Overview
Now that you've extended the domain model, it's time to create the pages for
managing training events. You will do this by creating an Overview and NewEdit
page as you have done before, but this time you will need to utilize your new
associations to get and set all the needed information. As you can see in the
wireframe below, the Training Event Overview page will need to display data from
four different entities.
Let's start with the homepage:

1. Create a fifth homepage button. Go to your Home_Web page and add a row
to the Layout grid. Duplicate the column layout of the first row by choosing
the 3,3,3,3 option.

2. Drag and drop a Button from the toolbox or copy and paste one that you
already have.

Change the button's caption to Training Events, and look for the calendar icon.
Also set the Appearance settings Size: Large and Full width.

2. Go to the On click field and select show a page. In the select web page
pop up, click New.
3. Time to configure your new page. Set the page name to
TrainingEvent_Overview. Choose Atlas_Default for the Navigation layout
and the List template like the other overview pages. Click OK. Click OK
again on the button edit window.

5. Now for the overview page itself! Go to the new TrainingEvent_Overview


page. Change the header to Training Events.
6. Next connect the list view with the TrainingEvent entity. Double-click the list
view and the Edit list view window will pop up. Click on Data source. In the
Entity (path) field, click Select and choose TrainingEvent entity.

7. Do not automatically fill the contents of the list view.

Looking good! In the next bit, you'll cross those associations to get data from four
different entities on to this page.

Use Associations in Parameters


Now that you've created the Overview page, you have to configure the list view to show the
students the following information:

• The course being taught


• On which dates

• Who is teaching it

• The location

1. Let's prepare the text widgets you will use. Copy and paste the Secondary text widget
two more times:

When this page is finished, you'll want it to show four things: the Course Title, Start and End
dates, Teacher Name and Location name. You can also use some static text to make it more
understandable. Here's what it will look like once all that is configured:

2. Now, you can use an association for the course title.a. Double-click the first List item
title. (This will become {.../Course/Title} as shown in the image above.) b. Click Edit
next to the Caption field in the Edit Text window.c. In the Caption field on the Edit
Caption window, type {1}. Click New to set the parameter that will be displayed in {1}.
Click Select in the Edit Template Parameter pop up, expand the Course dropdown,
and pick Title. (See the screenshot below to compare to the popups you have open.) d.
Click Select and then OK on each open window. You've just used an association! Let's
go grab the rest.

3. Continue with the two Dates, then the Teacher Name, then the Location Address.

This is what it will look like:

4. Cool! The Training Event Overview is complete. Add a Navigation menu item that goes
to this page so that you can get to it from anywhere within the app.

The final step is to create the New button and the NewEdit page for Training Events.

PreviousNext
Create Training Event NewEdit Page
Now you have to create the New button and the NewEdit page that will let you configure
Training Events. You will create these in the same way you did the previous four, but the
NewEdit page will turn out a bit differently because it will use Associations rather than just text
entry fields.

1. In the header of the Training Event overview page, create a new column and set it to
Auto-fit content.

2. Drag and drop a Create button from the toolbox into the new column.
3. In the pop up window, select TrainingEvent entity.

4. Change the button style to Success.


5. Go to the On click page field and click Select and New to create a new page.
6. The page name field is set correctly! TrainingEvent_NewEdit is what you want. Change
the Navigation layout to PopupLayout and choose Form Vertical for the template.
Click OK.

7. Go check out your new TrainingEvent_NewEdit page. See those bottom three widgets?
Those use the associations you set up. Move the two Date widgets beneath the Course
widget just so this form makes a bit more sense.

Those three association input widgets are called Reference selectors, and they are not
connected to attributes. (Sometimes they are interchangeably referred to as Drop-Downs, but if
you look in the Toolbox you will see that these are two different widgets. What we're using here
is a Reference selector, not a true Drop-down.) Reference selectors allow you to set
associations between existing objects — in this case, between this new Training Event and a
Course, a Location, and a Teacher which are already in the database.

Mendix has automatically set these widgets up for you, but in the properties of a reference
selector you can choose which attribute of the target entity to display in the list. In our case,
Titles and Names work just fine but you may have to configure these yourself in the future.
Here is what your page should look like:

8. Lastly, configure the On-click behavior of the List view on the TrainingEvent_Overview
page to go to the TrainingEvent_NewEdit page for editing existing objects.

9. Run your app and try it out! Schedule some training events. Now you will be able to
select all the necessary information!
10. When you are done, go to the Developer Portal and set this user story to Done.
11. Commit your work, since you've completed a feature. Mission accomplished!
PreviousNext
Add Training Events from the Homepage
Jimmy is very pleased with the new functionality since it helps him in his daily job. However, he
finds that 90% of his work revolves around scheduling training events. By contrast, he rarely
hires new teachers or finds new locations. With this in mind, he asks if he could have a button
on the homepage to schedule a training event directly. This button will go straight to the
Training Event NewEdit page rather than an overview page.

So together with Jimmy you have written the following user story:
As an administrator, I want to be able to schedule a training event directly from the homepage,
so I spend as little time as possible on this. Before starting with the new button, find the user
story in the Developer Portal and set it to In Progress.

1. Go to the Home_Web page. Add a new button to the homepage next to the Training
Events one. This time, copy and paste a button you already have to speed up the
process, and then adjust its settings.
2. Make sure the new button has this configuration:

• Caption Add a Training Event.

• Select the add icon.

• In the On click field, select Create object.

• In the Entity (path)field, select TrainingEvent.

• In the On click page field, select TrainingEvent_NewEdit.

The Home_Web page should now look like this:

Test it out, and if you're sure everything works, complete this user story.

Nice job! With the new button you just created, Jimmy can now schedule new training events
directly from the homepage of his app. Next up you'll tackle the last bit of information to get
Jimmy's company back in business: signing up trainees.

PreviousNext
Information Entities
Just a bit ago, you built the functionality to schedule training events and you learned about the
Domain model and associations. You created connections between TrainingEvent, Course,
Location and Teacher. Did you notice that Trainee is not connected to another entity yet? The
next user story will change that: As an administrator, I want to be able to add registrations to a
training event, so that my teachers know who their students will be.

Jimmy wants to be able to register Trainees to Training Events. This means that they will
need to be connected by an association. A training event can have multiple Trainees in
attendance, and a Trainee can attend multiple training events. So, this looks like it will be a
many-to-many association, also known as a reference set. However, Jimmy would like to be
able to add some information to this association. Specifically, he is requesting to store the date
the trainee signed up, whether or not they came to class, and a unique registration number to
keep better track of the many registrations he'll be dealing with. But you can't store anything in
the association, apart from the connection itself and its name. It also makes no sense to store
this data on either the TrainingEvent or the Trainee, since both need to be able to have
multiple sets of registration info associated with them.

What you need is a different approach than just a regular many-to-many association. You need
an entity in between Trainee and TrainingEvent that says something about the connection
between the two and simplifies it. This is called an information entity.

See how it stores all the requested info? Every time a Trainee signs up for a Training Event,
exactly one Registration will be created. It will be associated with only the Trainee who
registered, and only with the Training Event they registered for. Thus, you can use two one-to-
many associations here instead of a problematic many-to-many. Let's go do this.

PreviousNext

Extend the Domain Model


It's time to use an Information Entity to allow Jimmy to record registrations for the classes he
will offer.

1. Go to the Developer Portal and set the following user story to In Progress: "As an
administrator, I want to be able to add registrations to a training event, so that my
teachers know who their students will be."
2. In the Domain model, place a new entity between TrainingEvent and Trainee and
name it Registration.
3. Give your new entity the requested attributes:

• Number
• This is going to be an AutoNumber attribute because it will auto-increment with
each newly created Registration, which means each Registration will have a
unique registration number.
• Date

• This is of course going to be a DateAndTime attribute, but wouldn't it be nice if


the date was automatically set to the moment that the Registration was
created? You can do this by setting a default value. As you create the attribute,
set the Default value down at the bottom to [%CurrentDateTime%].
• Attended
• This will say whether someone showed up or not, so it will be a Boolean
attribute. Yes or No.

4. Create one-to-many associations between Registration and TrainingEvent and


Trainee, so that each registration can be associated with just one trainee and just one
training event.

This is what your Domain model should look like now:

PreviousNext
Nested Data
Now of course you'll need an Overview and NewEdit page to manage
Registrations. However, there are some special considerations to take into account
this time around.

If you create an Overview page like you have done in the past with a List view
showing every Registration in the database, it will quickly become too large to be
useful! Jimmy might have ten locations that he trains at, but certainly not a
thousand, so showing them all on one page is fine. But if each Training Event has
the possibility to have ten or more registrations, you can see how we could quickly
wind up with thousands of Registration objects after a few months or years. A
single list of all of them will be impossible to work with.

It needs to be filtered to show only the relevant objects from this large dataset. You
can do this in Mendix with search fields or filters in the data widget, but in this case
we can automate the process even further with something called Nesting. You'll
use nesting to allow Jimmy to look at small lists of Registrations based on which
Training Event he's currently interested in - ten or twenty at a time rather than
hundreds.

Nesting works by placing a List view inside a Data view and configuring both of
them to work together properly. If you want to look at the Registrations of a
particular TrainingEvent, you need to nest a Registration List view inside a
TrainingEvent Data view. This way, Mendix Studio can use the context of the data
view (a particular training event), to only show those registrations that belong to
this training event.

For that, you will need to:

• Create a new button in the TrainingEvent_Overview page.


• Create a new page for the registration overview and link the button you just
created to that page.
• Place a List View inside a Data view, so that only the registrations for that
specific training event are displayed.
• Configure dynamic data inside the Data view to show Training Event
information.
• Configure dynamic data inside the List view to show a list of Registration
information.
• Create a new button and a detail page to allow the user to create a new
registration for that specific training event.

In the next assignment, you'll tackle all that step-by-step. Get ready! This one is
tougher than before!

Create a Registration Page


You've got the framework in place to store registration information. Now you just
need a user interface so that it can be entered into the app. Let's go!

1. Go to the TrainingEvent_Overview page.


2. Look for the Open Page button in the Toolbox. Drop it above the ">" button
to place it just the left of the ">" button. This requires some precise mouse
skills, so it may take more than one try.

3. The Select web page window will open. The Registrations page doesn't
exist yet, so click New to create it now.

• Because this page involves two different entities, call it


TrainingEvent_Registration_Overview.
• You are going to create this page from scratch, so select the Blank
template.
• Make sure to use the Atlas_Default navigation layout.
• Click OK.

4. Change the new button's caption to Registrations.


5. The new button looks dull, so let's give it a different style so it stands out
more. With the Registrations button selected, in the Properties pane, look
for the Button style selector and set it to Info.

6. Ready for a Studio Pro shortcut? Right-click your finished Registrations


button and click Go to on click page
(MyFirstModule.TrainingEvent_Registration_Overview). There are lots
of places in Studio Pro with shortcuts like this. Experiment!

In the next lecture you will edit the Registration overview page so that it becomes
functional. You will learn how to nest data using Training Events as context.

How to Nest Data


You should now be on the TrainingEvent_Registration_Overview page you just created. The
page only has a single empty column on it, so the first thing you need to do is add a Data view
inside that column.

Data views

The data view widget allows you to look at and change the information of one specific object. In
fact, all the NewEdit pages you have created so far contain data views, because each is editing
one specific object. The data view connects to the context of the page, or the starting point. In
this case, that is the TrainingEvent object. To get to this page, Jimmy will see a list of Training
Events on the Training Event overview page and each one will have a Registrations button
next to it. Depending on which Registrations button he clicks, he can choose which
TrainingEvent object is sent to this new page as the context.

1. Drop a new Data view widget inside the column (which you can find in the Toolbox).
2. Connect Data view widget to the TrainingEvent entity. Do not automatically fill the
contents of the page.
3. Double-click Data view widget. In the Show footer field, click No.
4. Now let's add a header (page title) to the page so that the end-user knows which
training event's registrations they are looking at. At the top of the Toolbox, switch the
toggle from Widgets to Building blocks. Look for the Pageheader with controls
building block in the Toolbox and place it inside the DATA VIEW CONTENT portion of
the data view.

Building blocks have been designed by the Mendix UX Team, so they ensure that you are
adding a user-friendly section to your page. Each one is a template composed of multiple
widgets with styling properties applied. All you have to do is drag and drop the building blocks
into your page and then (if needed) connect them to your data or pages. You can always
change a building block to your preferences once you've placed it.

5. Using the large text widget that comes with it, configure a descriptive title using
information from the Training Event: something like Registrations for the {Course/Title}
on {StartDate}.

6. Delete the white Action button; you won't be needing it, but you'll use the blue one
later.
7. Add a new full-width row to the building block's layout grid. There are a few different
ways to do this.

8. Place a new List view inside the new column that appears.
9. Open the properties of the List view and open the Select Entity window on the Data
source tab. You should see two different Registration options to choose from:

The lower one is the contextual option you're familiar with. If you were to select that one, you
would be shown the unfiltered list of all Registrations in the database. What Jimmy wants is the
top option, underneath the Registration_TrainingEvent dropdown. This will only show
Registrations with an association to the training event the Data view is connected to. Pick the
top Registration and click Select.

Woo, you have just nested data! Now let's use our nested connection to the database to
display some dynamic data.

6. Add a Text widget to your List view content and configure its caption and parameters to
show the Trainee's Name, Registration Number, and Registration Date.

The Registration overview is complete. What is left? A way for Jimmy to add registrations of
course! Next you'll create the NewEdit page. You're in the home stretch for this user story.
PreviousNext

Create Registration NewEdit


Now it's time to add the functionality to be able to add and edit registrations.

1. Change the caption of the Action button to New.


2. Set its On-click behavior to Create Object.
3. Now choose the entity. Find the correct Registration entity and click Select.
When selecting the Registration entity, remember to use the
TrainingEvent as a constraint!

4. Select the On click page and create a new page within the window that pops
up. You know the drill. Registration_NewEdit, Popup layout and Form
Vertical.

2. Open the properties of the list view and change the On click action to Show
a page. Choose your new page, Registration_NewEdit.
3. Open the Registration_NewEdit page you just created. Make sure that the
first thing Jimmy can do on that page is to select a Trainee. Also, this is
probably the most important information about the Registration, so it should
be the first editable field. Move the Trainee selection widget above the Date
selection widget.

4. Run your app locally and try making some registrations. You did it! This user
story is finished. Go to the Developer Portal and set the story to Done.

Summary
In this module, you were introduced to associations, which allows connecting different types of
data together to form relationships.

You've just about got all your UI set up for this app! Jimmy can now do everything he was
doing before manually. But you worked so fast, you've actually got plenty of time left on the
project, so now you can move into some quality of life user stories that will make Jimmy's job
even easier.

PreviousNext

SPANISH
Objetivos de aprendizaje
Al final de este módulo, podrá:

• Amplíe el modelo de dominio de su aplicación


• Explicar la relación entre el modelo de dominio y la base de datos.
• Aplicar asociaciones en el modelo de dominio.
• Usar asociaciones en parámetros
• Utilice selectores de referencia en una página para establecer asociaciones
entre objetos existentes
• Cree una página de eventos de capacitación y agregue datos desde la
página de inicio
• Identificar cuándo utilizar entidades de información y ampliar el modelo de
dominio.
• Reconocer cuándo son necesarios datos anidados y utilizarlos para crear
una página.
Programación de eventos de capacitación
¡Felicidades! Ha completado su primera historia de usuario. ¡Excelente trabajo, realmente
estás empezando a entender esto!

Jimmy está muy satisfecho con el trabajo que has realizado. Puede comenzar a agregar sus
datos al sistema, lo cual es realmente útil para LearnNow. ¡Echemos un vistazo a cómo están
estructurados sus datos hasta ahora! Para ello, echaremos un vistazo al modelo de dominio.

Ampliando el modelo de dominio

La siguiente característica que sería útil para Jimmy es la capacidad de programar eventos de
capacitación, como se detalla en su siguiente historia de usuario: Como administrador,
quiero poder programar un evento de capacitación en cualquier momento, para que los
profesores puedan ver sus horario, incluso desde su teléfono. Con esta función, Jimmy
puede programar capacitaciones en la aplicación y los profesores pueden ver cuándo y dónde
deben organizar un curso.

Los eventos formativos son un dato nuevo. Para que sea dinámico, debe estar en el modelo
de dominio. Agregar nuevas entidades o atributos al modelo de dominio es algo que llamamos
extender el modelo de dominio. Esto hará que su base de datos cambie, pero Mendix se
encarga de todo eso por usted.

La base de datos

La estructura del modelo de dominio determina cómo se verá la base de datos. Cada entidad
se convertirá en una tabla de base de datos y cada atributo se convertirá en una columna de
la base de datos. Cada objeto que almacena en la base de datos (por ejemplo, un curso) se
convierte en una fila en la tabla de la base de datos correspondiente. Esto también significa
que si algo no está en el modelo de dominio, tampoco podrá agregar esa información a la
base de datos.

Así es como se ve la tabla de base de datos para la entidad Curso :

¿Ves esa columna de identificación? Eso no es un atributo. Entonces, ¿cómo acabó en la


tabla de la base de datos? Esto es algo que Mendix hace automáticamente por usted, porque
cada objeto siempre necesita un identificador único (un ID) para que el sistema sepa qué
objeto es. Incluso si crea dos objetos idénticos con valores de atributos idénticos, seguirán
teniendo dos números de identificación únicos y serán tratados como dos objetos diferentes.

Puede cambiar el modelo de dominio tantas veces como desee y la base de datos se
sincronizará cuando vuelva a ejecutar la aplicación. Además, cuando cambias el nombre de
una entidad o atributo, tu aplicación seguirá funcionando inmediatamente, porque Mendix
Studio Pro aplicará automáticamente estos cambios en todas partes.

AnteriorPróximo

Agregar una nueva entidad al modelo de dominio


¡En esta tarea, permitirás que Jimmy programe eventos de capacitación en su aplicación!

1. Vaya al Portal del desarrollador y configure la siguiente historia en En progreso: "Como


administrador, quiero poder programar un evento de capacitación en cualquier
momento, para que los maestros puedan ver su agenda incluso desde su teléfono".

Jimmy agregó la siguiente descripción a la historia: “Al programar un evento de capacitación,


será necesario seleccionar una ubicación y un curso junto con el maestro que será el anfitrión
del evento. De esta forma, el profesor puede ver qué curso tendrá que impartir y
dónde. También debería poder seleccionar una fecha de inicio y finalización para el curso,
para que los profesores puedan ver en qué días se realizará el curso".

2. Abra el modelo de dominio y agregue una nueva entidad


llamada TrainingEvent . Utilice PascalCase para el nombre y recuerde que los
nombres de las entidades siempre deben ser singulares.

Jimmy dijo que quiere que un evento de capacitación tenga una fecha de inicio y una fecha de
finalización.

3. Agregue dos atributos a la entidad


TrainingEvent: StartDate y EndDate . Probablemente puedas adivinar qué tipo de
atributo debería tener esta entidad: ¡Fecha y hora!

¡Excelente! Ha agregado una nueva entidad a su modelo de dominio. Su modelo de dominio


ahora debería verse así:
Quizás te preguntes: ¿Por qué la entidad TrainingEvent solo tiene dos atributos? ¿No debería
incluir también información de ubicación? La respuesta es que ya tenemos ese tipo de
información almacenada en las otras entidades. Sólo tenemos que conectarles TrainingEvent
mediante Associations .

AnteriorPróximo
Asociaciones en el modelo de dominio
En el modelo de dominio, las entidades pueden interactuar entre sí a través
de asociaciones . Parecen flechas entre Entidades. Por ejemplo, es necesario poder
almacenar en el sistema qué curso se impartirá, dónde se alojará, quién lo impartirá y cuándo
se realizará.

De la forma en que Jimmy dirige las cosas, un evento de capacitación siempre será para un
solo curso, en un lugar y organizado por un solo maestro. Si lo piensas desde el otro lado,
todas esas cosas se reutilizarán para múltiples eventos de capacitación. Con el tiempo, un
curso se programará más de una vez, las ubicaciones se utilizarán más de una vez y los
profesores organizarán muchos eventos de capacitación.

Para cada asociación que agregue a su modelo de dominio, se creará una nueva tabla de
base de datos. Esta tabla almacenará las ID de los objetos conectados entre sí. Al igual que
las Entidades, recuerde que una Asociación es el modelo. Luego, los propios objetos deben
asociarse entre sí y sus ID deben almacenarse en la tabla. Realizar una asociación en el
modelo de dominio no significa que todos los Objetos involucrados estarán asociados entre
sí. Simplemente significa que ahora existe la posibilidad de hacerlo.

En Mendix Studio Pro podrás elegir entre tres tipos de asociaciones, que vamos a explicar
poniendo como ejemplo el fútbol. (¡Americano o fútbol, tú eliges!) En el fútbol, tienes equipos,
jugadores, estadios y ligas. Las posibles asociaciones se describen a continuación.

Asociación uno a muchos (1–*)

Esta es la asociación más utilizada. En el ejemplo, se trata de la asociación entre un jugador y


un equipo. Un jugador siempre juega para un equipo específico, pero un equipo tiene varios
jugadores.

Asociación uno a uno (1–1)

Esta es la asociación donde dos objetos sólo pueden asociarse entre sí y no con ningún otro
objeto al mismo tiempo. En el ejemplo del fútbol, esto se muestra en la asociación entre un
equipo y un estadio. Un equipo sólo puede tener un estadio local y un estadio sólo puede
tener un equipo local. Su mascota también está en una asociación uno a uno.

Conjunto de referencia (* – *)

A esto también se le llama asociación de muchos a muchos. En el caso del ejemplo del fútbol,
muchos equipos juegan en una liga, pero un equipo también puede competir en varias ligas.
Echemos otro vistazo a la descripción que Jimmy agregó a la historia del usuario: "Al
programar un evento de capacitación, será necesario seleccionar una ubicación y un curso
junto con qué maestro será el anfitrión del evento".

Antes de que pueda empezar a pensar en inscribir aprendices, primero debe poder agregar
eventos de capacitación a su agenda. Entonces, para esta historia de usuario, se concentrará
en esa funcionalidad y, en la siguiente historia de usuario, buscará agregar registros a los
eventos de capacitación.

AnteriorPróximo

Agregar asociaciones
¡Pongamos esto en práctica! El evento de capacitación debe tener una conexión con un curso,
ubicación y capacitador. De esta manera, puedes almacenar en el sistema qué curso se
impartirá, dónde se alojará y quién lo impartirá.

1. Pase el mouse sobre la entidad TrainingEvent. Haga clic en el círculo blanco que
aparece en el borde de la entidad y arrastre una nueva asociación a la entidad
Curso. La asociación se creará como una asociación de uno a muchos de forma
predeterminada. Para cambiar el tipo de asociación, simplemente haga doble clic en la
asociación y seleccione un tipo diferente.

¡Observa que las asociaciones también tienen nombres! El nombre de esta asociación
es TrainingEvent_Course . Esta es la convención de nomenclatura para las
asociaciones: Entity1_Entity2 . Puede hacer que el nombre de la asociación sea más
descriptivo si necesita distinguir entre dos o más asociaciones similares, pero el guión bajo
que muestra dónde termina una entidad y comienza la otra es importante. En aplicaciones
más simples, los nombres predeterminados son los mejores.

2. Continúe y cree todas las asociaciones de acuerdo con la descripción que proporcionó
Jimmy. Asegúrese de reorganizar su modelo de dominio (si es necesario) para que
todas las etiquetas de asociación sean fáciles de leer.

Cuando termine, debería ver esto. Esta parte de la aplicación es importante porque todo lo
que hagas a partir de ahora se basará en ella, así que asegúrate de tener todo bien:

Consejo: ¿Creaste accidentalmente la asociación en la dirección incorrecta? No te preocupes,


puedes simplemente eliminarlo y recrearlo en la otra dirección.

AnteriorPróximo
Crear descripción general del evento de capacitación
Ahora que ha ampliado el modelo de dominio, es hora de crear las páginas para gestionar
eventos de formación. Lo hará creando una página Descripción general y Nueva edición como
lo hizo antes, pero esta vez necesitará utilizar sus nuevas asociaciones para obtener y
configurar toda la información necesaria. Como puede ver en la estructura alámbrica a
continuación, la página Descripción general del evento de capacitación deberá mostrar datos
de cuatro entidades diferentes.

Comencemos con la página de inicio:

1. Crea un quinto botón de página de inicio. Vaya a su página Home_Web y agregue una
fila a la cuadrícula de Diseño. Duplique el diseño de columnas de la primera fila
eligiendo la opción 3,3,3,3.

2. Arrastre y suelte un botón desde la caja de herramientas o copie y pegue uno que ya
tenga.

Cambie el título del botón a Eventos de capacitación y busque el ícono del


calendario . También establezca la configuración de Apariencia Tamaño: Grande y Ancho
completo .

2. Vaya al campo Al hacer clic y seleccione mostrar una página. En la ventana


emergente de selección de página web, haga clic en Nuevo .
3. Es hora de configurar tu nueva página. Establezca el nombre de la página
en TrainingEvent_Overview. Elija Atlas_Default para el diseño de navegación y la
plantilla de lista como las otras páginas de descripción general. Haga clic
en Aceptar . Haga clic en Aceptar nuevamente en la ventana de edición del botón.

5. ¡Ahora vamos a la página de descripción general! Vaya a la nueva página


TrainingEvent_Overview. Cambie el encabezado a Eventos de capacitación.
6. Luego conecte la vista de lista con la entidad TrainingEvent. Haga doble clic en la vista
de lista y aparecerá la ventana Editar vista de lista. Haga clic en Fuente de datos. En
el campo Entidad (ruta), haga clic en Seleccionar y elija la entidad TrainingEvent .

7. No llene automáticamente el contenido de la vista de lista.

¡Luciendo bien! En el siguiente paso, cruzará esas asociaciones para obtener datos de cuatro
entidades diferentes en esta página.

AnteriorPróximo
Usar asociaciones en parámetros
Ahora que ha creado la página Descripción general, debe configurar la vista de lista para
mostrar a los estudiantes la siguiente información:

• El curso que se imparte

• en que fechas

• ¿Quién lo está enseñando?

• La locación

1. Preparemos los widgets de texto que utilizará. Copie y pegue el widget de texto
secundario dos veces más:

Cuando finalice esta página, querrá que muestre cuatro cosas: el título del curso, las fechas
de inicio y finalización, el nombre del profesor y el nombre de la ubicación. También puedes
utilizar texto estático para hacerlo más comprensible. Así es como se verá una vez que todo
esté configurado:

2. Ahora puede utilizar una asociación para el título del curso.


a. Haga doble clic en el primero List item title. (Esto se convertirá en
{…/Curso/Título} como se muestra en la imagen de arriba).
b. Haga clic en Editar junto al campo Título en la ventana Editar texto .
C. En el campo Título de la ventana Editar título , escriba {1} . Haga clic en Nuevo
para configurar el parámetro que se mostrará en {1}. Haga clic en Seleccionar en
la ventana emergente Editar parámetro de plantilla , expanda el menú
desplegable Curso y seleccione Título . (Vea la captura de pantalla a continuación
para compararla con las ventanas emergentes que tiene abiertas).
d. Haga clic en Seleccionar y luego en Aceptar en cada ventana abierta. ¡Acabas de
utilizar una asociación! Vamos a coger el resto.

3. Continúe con las dos fechas, luego el nombre del maestro y luego la dirección de la
ubicación.

Así es como se verá:


4. ¡Fresco! La descripción general del evento de capacitación está completa. Agregue un
elemento del menú de navegación que vaya a esta página para que pueda acceder a
ella desde cualquier lugar dentro de la aplicación.

El último paso es crear el botón Nuevo y la página NuevoEditar para Eventos de capacitación.

AnteriorPróximo
Crear evento de capacitación Nueva página de
edición
Ahora tienes que crear el botón Nuevo y la página NuevoEditar que te permitirá configurar
Eventos de capacitación. Los creará de la misma manera que los cuatro anteriores, pero la
página NewEdit resultará un poco diferente porque usará Asociaciones en lugar de solo
campos de entrada de texto.

1. En el encabezado de la página de descripción general del evento de capacitación,


cree una nueva columna y configúrela para ajustar automáticamente el contenido.

2. Arrastre y suelte un botón Crear desde la caja de herramientas en la nueva columna.


3. En la ventana emergente, seleccione la entidad TrainingEvent.

4. Cambie el estilo del botón a Éxito .


5. Vaya al campo Página al hacer clic y haga clic en Seleccionar y Nuevo para crear
una nueva página.
6. ¡El campo de nombre de la página está configurado
correctamente! Train ingEvent_NewEdit es lo que quieres. Cambie el diseño de
navegación a PopupLayout y elija Formulario vertical para la plantilla. Haga clic
en Aceptar.

7. Vaya a ver su nueva página TrainingEvent_NewEdit. ¿Ves esos tres widgets


inferiores? Estos utilizan las asociaciones que usted configura. Mueva los dos widgets
de Fecha debajo del widget de Curso para que este formulario tenga un poco más de
sentido.

Esos tres widgets de entrada de asociación se denominan selectores de referencia y no


están conectados a atributos. (A veces se les conoce indistintamente como menús
desplegables, pero si miras en la Caja de herramientas verás que son dos widgets diferentes.
Lo que estamos usando aquí es un selector de referencia, no un verdadero menú
desplegable). Selectores de referencia le permite establecer asociaciones entre objetos
existentes, en este caso, entre este nuevo evento de capacitación y un curso, una ubicación y
un profesor que ya están en la base de datos.

Mendix ha configurado automáticamente estos widgets para usted, pero en las propiedades de
un selector de referencia puede elegir qué atributo de la entidad de destino mostrar en la
lista. En nuestro caso, los Títulos y Nombres funcionan bien, pero es posible que tengas que
configurarlos tú mismo en el futuro. Así es como debería verse su página:

8. Por último, configure el comportamiento al hacer clic de la vista de lista en la página


TrainingEvent_Overview para ir a la página TrainingEvent_NewEdit para editar objetos
existentes.

9. ¡Ejecute su aplicación y pruébela! Programe algunos eventos de capacitación. ¡Ahora


podrás seleccionar toda la información necesaria!
10. Cuando haya terminado, vaya al Portal del desarrollador y configure esta historia de
usuario en Listo .

11. Confirma tu trabajo, ya que has completado una función. ¡Misión cumplida!
AnteriorPróximo
Agregar eventos de capacitación desde la página de
inicio
Jimmy está muy satisfecho con la nueva funcionalidad, ya que le ayuda en su trabajo
diario. Sin embargo, descubre que el 90% de su trabajo gira en torno a la programación de
eventos de formación. Por el contrario, rara vez contrata nuevos profesores o encuentra
nuevos lugares. Teniendo esto en cuenta, pregunta si podría tener un botón en la página de
inicio para programar un evento de capacitación directamente. Este botón irá directamente a la
página NewEdit del evento de capacitación en lugar de a una página de descripción general.

Así que, junto con Jimmy, has escrito la siguiente historia de usuario:
Como administrador, quiero poder programar un evento de formación directamente desde la
página de inicio, así que dedico el menor tiempo posible a esto. Antes de comenzar con el
botón nuevo, busque la historia del usuario en el Portal del desarrollador y configúrela en En
progreso .

1. Vaya a la página Inicio_Web. Agregue un nuevo botón a la página de inicio junto al de


Eventos de capacitación. Esta vez, copia y pega un botón que ya tienes para acelerar
el proceso y luego ajusta su configuración.
2. Asegúrese de que el nuevo botón tenga esta configuración:
• Título Agregar un evento de capacitación.

• Seleccione el icono de agregar .

• En el campo Al hacer clic , seleccione Crear objeto .

• En el campo Entidad (ruta ), seleccione TrainingEvent.

• En el campo Página al hacer clic , seleccione TrainingEvent_NewEdit .

La página Home_Web ahora debería verse así:

Pruébelo y, si está seguro de que todo funciona, complete esta historia de usuario.

¡Buen trabajo! Con el nuevo botón que acaba de crear, Jimmy ahora puede programar nuevos
eventos de capacitación directamente desde la página de inicio de su aplicación. A
continuación, abordará la última información para que la empresa de Jimmy vuelva a
funcionar: inscribir aprendices.

AnteriorPróximo
Entidades de Información
Hace un momento, creó la funcionalidad para programar eventos de capacitación y aprendió
sobre el modelo de dominio y las asociaciones. Creó conexiones entre TrainingEvent, Course,
Location y Teacher. ¿Notaste que Trainee aún no está conectado a otra entidad? La siguiente
historia de usuario cambiará eso: como administrador, quiero poder agregar inscripciones a un
evento de capacitación, para que mis profesores sepan quiénes serán sus estudiantes.

Jimmy quiere poder registrar aprendices en eventos de capacitación . Esto significa que
deberán estar conectados por una asociación. Un evento de capacitación puede tener la
asistencia de varios alumnos y un alumno puede asistir a varios eventos de
capacitación. Entonces, parece que será una asociación de muchos a muchos, también
conocida como conjunto de referencia. Sin embargo, a Jimmy le gustaría poder agregar
alguna información a esta asociación. Específicamente, solicita almacenar la fecha en que se
inscribió el alumno, si asistió o no a clase, y un número de registro único para realizar un
mejor seguimiento de los muchos registros con los que tendrá que lidiar. Pero no puedes
almacenar nada en la asociación, aparte de la conexión misma y su nombre. Tampoco tiene
sentido almacenar estos datos en TrainingEvent o Trainee, ya que ambos deben poder tener
múltiples conjuntos de información de registro asociados.

Lo que necesita es un enfoque diferente al de una simple asociación de muchos a


muchos. Necesita una entidad entre Trainee y TrainingEvent que diga algo sobre la conexión
entre los dos y la simplifique. Esto se llama entidad de información .
¿Ves cómo almacena toda la información solicitada? Cada vez que un alumno se inscribe en
un evento de formación, se creará exactamente una inscripción. Se asociará únicamente con
el alumno que se registró y únicamente con el evento de capacitación en el que se
registró. Por lo tanto, aquí puede utilizar dos asociaciones de uno a muchos en lugar de una
problemática de muchos a muchos. Vamos a hacer esto.

AnteriorPróximo

Ampliar el modelo de dominio


Es hora de utilizar una entidad de información que le permita a Jimmy registrar las
inscripciones para las clases que ofrecerá.

1. Vaya al Portal del desarrollador y configure la siguiente historia de usuario


en En curso : "Como administrador, quiero poder agregar inscripciones a
un evento de capacitación, para que mis profesores sepan quiénes serán
sus estudiantes".
2. En el modelo de Dominio, coloque una nueva entidad
entre TrainingEvent y Trainee y asígnele el nombre Registro .
3. Dale a tu nueva entidad los atributos solicitados:

• Número
• Este será un atributo de Autonumérico porque se incrementará
automáticamente con cada Registro recién creado , lo que significa
que cada Registro tendrá un número de registro único.
• Fecha
• Por supuesto, esto será un atributo DateAndTime, pero ¿no sería
bueno si la fecha se estableciera automáticamente en el momento en
que se creó el registro? Puede hacerlo estableciendo un valor
predeterminado. A medida que crea el atributo, establezca el valor
predeterminado en la parte inferior en [%CurrentDateTime%] .
• Asistió
• Esto dirá si alguien apareció o no, por lo que será un atributo
booleano. Sí o no.

4. Cree asociaciones de uno a varios


entre Registration y TrainingEvent y Trainee , de modo que cada registro
pueda asociarse con un solo aprendiz y un solo evento de capacitación.
Así es como debería verse su modelo de dominio ahora:

Datos anidados
Ahora, por supuesto, necesitará una página Descripción general y Nueva edición para
administrar los registros. Sin embargo, hay algunas consideraciones especiales a tener en
cuenta esta vez.

Si crea una página de descripción general como lo hizo en el pasado con una vista de lista
que muestra todos los registros en la base de datos, rápidamente se volverá demasiado
grande para ser útil. Jimmy puede tener diez ubicaciones en las que entrena, pero ciertamente
no mil, por lo que mostrarlas todas en una página está bien. Pero si cada Evento de
Capacitación tiene la posibilidad de tener diez o más registros, puede ver cómo rápidamente
podríamos terminar con miles de objetos de Registro después de unos meses o años. Será
imposible trabajar con una lista única de todos ellos.

Es necesario filtrarlo para mostrar solo los objetos relevantes de este gran conjunto de
datos. Puedes hacer esto en Mendix con campos de búsqueda o filtros en el widget de datos,
pero en este caso podemos automatizar aún más el proceso con algo
llamado Nesting . Utilizará el anidamiento para permitirle a Jimmy ver pequeñas listas de
registros según el evento de capacitación que le interese actualmente: diez o veinte a la vez
en lugar de cientos.

El anidamiento funciona colocando una vista de lista dentro de una vista de datos y
configurándolas para que funcionen juntas correctamente. Si desea ver los registros de
un TrainingEvent en particular , debe anidar una vista de lista de registros dentro de una
vista de datos de TrainingEvent . De esta manera, Mendix Studio puede utilizar el contexto
de la vista de datos (un evento de capacitación en particular), para mostrar solo aquellos
registros que pertenecen a ese evento de capacitación.

Para eso, necesitarás:

• Cree un nuevo botón en la página TrainingEvent_Overview .

• Cree una nueva página para la descripción general del registro y vincule el botón que
acaba de crear a esa página.

• Coloque una Vista de lista dentro de una Vista de datos , de modo que solo se
muestren las inscripciones para ese evento de capacitación específico.

• Configure datos dinámicos dentro de la vista Datos para mostrar información del
evento de capacitación.

• Configure datos dinámicos dentro de la vista de lista para mostrar una lista de
información de registro.
• Cree un nuevo botón y una página de detalles para permitir al usuario crear un nuevo
registro para ese evento de capacitación específico.

En la próxima tarea, abordarás todo eso paso a paso. ¡Prepararse! ¡Éste es más duro que
antes!

AnteriorPróximo
Crear una página de registro
Tiene el marco implementado para almacenar información de registro. Ahora sólo necesita
una interfaz de usuario para poder ingresar a la aplicación. ¡Vamos!

1. Vaya a la página TrainingEvent_Overview .


2. Busque el botón Abrir página en la Caja de herramientas. Suéltelo encima del
botón “>” para colocarlo justo a la izquierda del botón “>” . Esto requiere algunas
habilidades precisas con el mouse, por lo que puede ser necesario más de un intento.

3. Se abrirá la ventana Seleccionar página web . La página Registros aún no existe, así
que haga clic en Nuevo para crearla ahora.

• Debido a que esta página involucra dos entidades diferentes,


llámela TrainingEvent_Registration_Overview .

• Vas a crear esta página desde cero, así que selecciona la plantilla en blanco .

• Asegúrese de utilizar el diseño de navegación Atlas_Default .

• Haga clic en Aceptar .

4. Cambie el título del nuevo botón a Registros .


5. El nuevo botón parece aburrido, así que vamos a darle un estilo diferente para que
destaque más. Con el botón Registros seleccionado, en el panel Propiedades ,
busque el selector de estilo de botón y configúrelo en Información .

6. ¿Listo para un atajo de Studio Pro? Haga clic con el botón derecho en el botón
Registros terminados y haga clic en Ir a la página en la que haga clic
(MyFirstModule.TrainingEvent_Registration_Overview) . Hay muchos lugares en
Studio Pro con atajos como este. ¡Experimento!

En la próxima conferencia editará la página de descripción general de registro para que sea
funcional. Aprenderá cómo anidar datos utilizando Eventos de capacitación como contexto.

AnteriorPróximo
Cómo anidar datos
Ahora debería estar en la página TrainingEvent_Registration_Overview que acaba de
crear. La página solo tiene una columna vacía, por lo que lo primero que debe hacer es
agregar una vista de datos dentro de esa columna.

Vistas de datos

El widget de vista de datos le permite ver y cambiar la información de un objeto específico. De


hecho, todas las páginas NewEdit que ha creado hasta ahora contienen vistas de datos,
porque cada una edita un objeto específico. La vista de datos se conecta al contexto de la
página o al punto de partida. En este caso, ese es el objeto TrainingEvent . Para llegar a esta
página, Jimmy verá una lista de eventos de capacitación en la página de descripción general
de eventos de capacitación y cada uno tendrá un botón de Registro al lado. Dependiendo del
botón Registros en el que haga clic, puede elegir qué objeto TrainingEvent se envía a esta
nueva página como contexto.

1. Coloque un nuevo widget de vista de datos dentro de la columna (que puede


encontrar en la Caja de herramientas ).
2. Conecte el widget de vista de datos a la entidad TrainingEvent. No llene
automáticamente el contenido de la página.
3. Haga doble clic en el widget de vista de datos . En el campo Mostrar pie de página ,
haga clic en No.

4. Ahora agreguemos un encabezado (título de página) a la página para que el usuario


final sepa qué registros de eventos de capacitación está viendo. En la parte superior
de la Caja de herramientas, cambie el interruptor de Widgets a Bloques de
construcción . Busque el bloque de construcción Encabezado de página con
controles en la Caja de herramientas y colóquelo dentro de la parte CONTENIDO DE
LA VISTA DE DATOS de la vista de datos.

Los bloques de construcción han sido diseñados por el equipo de UX de Mendix, por lo que
garantizan que agregue una sección fácil de usar a su página. Cada uno es una plantilla
compuesta por múltiples widgets con propiedades de estilo aplicadas. Todo lo que tienes que
hacer es arrastrar y soltar los bloques de construcción en tu página y luego (si es necesario)
conectarlos a tus datos o páginas. Siempre puedes cambiar un bloque de construcción según
tus preferencias una vez que lo hayas colocado.

5. Usando el widget de texto grande que viene con él, configure un título descriptivo
usando información del evento de capacitación: algo así como Registros para el
{Curso/Título} el {StartDate} .

6. Elimine el botón de acción blanco ; No lo necesitarás, pero usarás el azul más tarde.
7. Agregue una nueva fila de ancho completo a la cuadrícula de diseño del bloque de
construcción. Hay algunas formas diferentes de hacer esto.

8. Coloque una nueva vista de Lista dentro de la nueva columna que aparece.
9. Abra las propiedades de la vista de lista y abra la ventana Seleccionar entidad en la
pestaña Fuente de datos. Deberías ver dos opciones de registro diferentes para elegir:

La inferior es la opción contextual con la que estás familiarizado. Si seleccionara ese, se le


mostraría la lista sin filtrar de todos los registros en la base de datos. Lo que Jimmy quiere es
la opción superior, debajo del menú desplegable Registration_TrainingEvent. Esto solo
mostrará los registros con una asociación al evento de capacitación al que está conectada la
vista de datos.
Elija el Registro superior y haga clic en Seleccionar.

¡Vaya, acabas de anidar datos! Ahora usemos nuestra conexión anidada a la base de datos
para mostrar algunos datos dinámicos.

6. Agregue un widget de texto al contenido de su vista de lista y configure su título y


parámetros para mostrar el nombre , el número de registro y la fecha de registro
del alumno .

La descripción general del registro está completa. ¿Lo que queda? ¡Una forma para que
Jimmy agregue registros, por supuesto! A continuación creará la página NewEdit. Estás en la
recta final de esta historia de usuario.

AnteriorPróximo

Crear registro nuevoEditar


Ahora es el momento de agregar la funcionalidad para poder agregar y editar
registros.

1. Cambie el título del botón Acción a Nuevo .


2. Establezca su comportamiento al hacer clic en Crear objeto .
3. Ahora elige la entidad. Busque la entidad de registro correcta y haga clic
en Seleccionar . Al seleccionar la entidad de Registro , recuerde
utilizar TrainingEvent como restricción.

4. Seleccione la página Al hacer clic y cree una nueva página dentro de la


ventana que aparece. Ya sabes que hacer. Registro_NewEdit , diseño de
ventana emergente y formulario vertical.
2. Abra las propiedades de la vista de lista y cambie la acción Al hacer
clic a Mostrar una página . Elija su nueva página, Registration_NewEdit .
3. Abra la página Registration_NewEdit que acaba de crear. Asegúrese de
que lo primero que Jimmy pueda hacer en esa página sea seleccionar un
aprendiz. Además, esta es probablemente la información más importante
sobre el Registro, por lo que debería ser el primer campo editable. Mueva el
widget de selección de aprendices encima del widget de selección de
fecha .

4. Ejecute su aplicación localmente e intente realizar algunos registros. ¡Lo


hiciste! Esta historia de usuario ha terminado. Vaya al Portal del
desarrollador y configure la historia en Listo .

Resumen
En este módulo, conoció las asociaciones, que permiten conectar diferentes tipos
de datos para formar relaciones.

¡Ya casi tienes toda tu interfaz de usuario configurada para esta aplicación! Jimmy
ahora puede hacer todo lo que hacía antes manualmente. Pero trabajó tan rápido
que en realidad le queda mucho tiempo en el proyecto, por lo que ahora puede
pasar a algunas historias de usuarios de calidad de vida que harán que el trabajo
de Jimmy sea aún más fácil.

You might also like