Doubt about add buttons

I am trying to develop a Reactive Web APP and I am currently in the stage of building the forms of the entities previously created. I have a table called "Internal Training". For each new formation created, I can have one or more trainees. My question lies here because I don't know how I can create a button in "Trainingdetails" to add more than one employee. Can anyone help me.

Thank you


Edgar Oliveira

Hi, friend!

If I understand well, you have an entity make the many to many relationship between Internal Training and Trainee or trainees are just records in the entity?

To have one or more trainees to a single InternalTraininId, create another entity to create one to many wih trainees.

Is that correct?

Hello Edgar,

What you are trying to achieve is a "Master Detail". 

You have some templates that create a page with what you need, but let me explain for you how to build one yourself.

First, you need a list to show the "Operadores" associated with the actual "Training Action".
To feed this list, you need an aggregate, that must fetch your "Operatores", filtered by the Training Action Identifier (probably an input parameter of the screen.

Now, you need to implement a way of adding "Operatores" to this training.

Many ways for doing that.
You can have a button that opens a Modal, in the modal you list Operators and have a button to add an operator to the current training action (and refresh the aggregate that shows them in the screen.

You can do something similar, but instead, open a Sidebar where you will list the available operators to add to this training.

And so on.

What do you think?

Eduardo Jauch wrote:

Hello Edgar,

What you are trying to achieve is a "Master Detail". 

You have some templates that create a page with what you need, but let me explain for you how to build one yourself.

First, you need a list to show the "Operadores" associated with the actual "Training Action".
To feed this list, you need an aggregate, that must fetch your "Operatores", filtered by the Training Action Identifier (probably an input parameter of the screen.

Now, you need to implement a way of adding "Operatores" to this training.

Many ways for doing that.
You can have a button that opens a Modal, in the modal you list Operators and have a button to add an operator to the current training action (and refresh the aggregate that shows them in the screen.

You can do something similar, but instead, open a Sidebar where you will list the available operators to add to this training.

And so on.

What do you think?

Hi Eduardo,

I'll try to follow your procedure and then I'll tell you how it went.  As I'm still new to this tool, it may take a while :).  Anyway, I appreciate your support.  Thank you


There is no Problem, 

Edgar. It's a pleasure being able to help.

If you find any trouble, just ask, and we will try to point you in the right direction. :)

Cheers

Lenon Manhães wrote:

Hi, friend!

If I understand well, you have an entity make the many to many relationship between Internal Training and Trainee or trainees are just records in the entity?

To have one or more trainees to a single InternalTraininId, create another entity to create one to many wih trainees.

Is that correct?

Hi Lenon, 

I was created one entity linked between the entity "Operators" and "Training". After, i drag the entity to Training details, but does not worked.

Thank you.

Edgar


Eduardo Jauch wrote:

There is no Problem, 

Edgar. It's a pleasure being able to help.

If you find any trouble, just ask, and we will try to point you in the right direction. :)

Cheers

Thanks Eduardo :)


Eduardo Jauch wrote:

There is no Problem, 

Edgar. It's a pleasure being able to help.

If you find any trouble, just ask, and we will try to point you in the right direction. :)

Cheers

Hello Eduardo,

I tried to follow your procedure, but I couldn't :(

I believe that the steps I'm taking are not the most correct. Please check my entities. Do you think they are well defined? After doing the "aggregate" for operators, I can't do the filter by training. I needed to create a button and add one or more operators to each training.


thanks,

Edgar


Sorry Edgar, Ass I didn't know your model, I just add some "generic" way of doing this.

You need an aggregate that fetches the FormacaoColaboradores entity, filtered by the FormacaoId, and in this same aggregate, you join the eneity Colaboradores (through the FK ColaboradorId in the FormacaoColaboradores). If you create an aggregate and first put the FormacaoColaboradores and than the Colaboradores, the join will be made correctly. Than you can add your filter, because now you have the FormacaoId attribute available inside the aggregate.

Than you can add attributes of the entity to the list (and set the list source to this aggregate).

After that, you can add a button to your screen that shows a modal with a list of available colaboradores that you can chose and with a button add them to the Formacao, adding records to the  FormacaoColaboradores entity.

Thanks Eduardo,

Can I aggregate entity FormacaoColaboradores if this entity is not in MainFlow?

Thanks

yes. entities store data. Aggregates fetch data from them. You can fetch data from any entity in any screen (roughly)

Eduardo Jauch wrote:

yes. entities store data. Aggregates fetch data from them. You can fetch data from any entity in any screen (roughly)


Dear Eduardo,

Thanks, can you verify please the attachment to see if i´m doing it right?

thank you.

Yes.

Now you need to add a filter in the Filter tab, to filter the FormacaoColaboradores.FormacaoId with the input parameter of your screen (FormacaoID, I am assuming). So that only the colaboradores at THIS formacao will show up.

Hi,

I make that :) but appear the error in attachement.

Because this is not a filter ;)

A filter must return True or False. For that, usually, we use a condition.
Like: FormacaoColaboradores.FormacaoId = FormacaoId

Where

FormacaoColaboradores.FormacaoId <- This is a reference to the the attribute in the aggregate

FormacaoId This is your Screen Input parameter.

For every line of the entity in the database, if those values are not the same, that line is excluded from the results.

Eduardo Jauch wrote:

Because this is not a filter ;)

A filter must return True or False. For that, usually, we use a condition.
Like: FormacaoColaboradores.FormacaoId = FormacaoId

Where

FormacaoColaboradores.FormacaoId <- This is a reference to the the attribute in the aggregate

FormacaoId This is your Screen Input parameter.

For every line of the entity in the database, if those values are not the same, that line is excluded from the results.

Eduardo,


Many thanks for your patience and help, but i need to see more videos :(

I follow your procedure, but something is wrong in my UI. Maby the contruction of the entity or the screen "FormacaoDetail" is wrong. To add more colaborators in the screen, i need a botton like "+" and after add the number of colaborators necessary. I can't make this link. I was able to create a button to delete the training, but I cannot create a button to add collaborators.
Anyway, I appreciate your effort. I am not yet well prepared for this step.


Edgar


No problem.

By the way, A button in a screen can do only 2 things: Navigate to another screen or execute a Screen Action.

So, you have to implement logic/UI in order to add colaboradores to the formação. 

If I have time (and no one else do this first), I'll implement a small example. Please, by the end of the week, if I don't return, drop a message here.

Cheers.

Eduardo Jauch wrote:

No problem.

By the way, A button in a screen can do only 2 things: Navigate to another screen or execute a Screen Action.

So, you have to implement logic/UI in order to add colaboradores to the formação. 

If I have time (and no one else do this first), I'll implement a small example. Please, by the end of the week, if I don't return, drop a message here.

Cheers.

Eduardo,
Thank you very much for your help. That would be excellent. 

I will try to understand better about "logic".

I'm probably complicating something simple.


Edgar