Association

WorkWithPlus provides the possibility to associate at runtime records that belong to certain transaction, to another transaction when it exists a N-to-N relation between them (with an association transaction).

In order to describe this feature, we will suppose that our application must handle multiple companies, and in each one we have to work with different currencies. This functionality allows application user to set which currencies will be associated to which companies in a simply and efficient way, like we explain below.

We will have 'Company' transaction which will represent the existing companies; 'Currency' transaction will represent all the existing currencies that can be needed for some Company record; and in order to associate which currencies are associated to a company, we have 'CurrencyCompany' transaction. This transaction relates 'Company' with 'Currency' in an n to n relation.

Company transaction

AssociationImg01

Currency Transaction

AssociationImg17

N-to-N relation transaction (CompanyCurrency)

AssociationImg03

This transaction contains as a primary key the PKs of both transactions (Company and Currency). It is necessary to set this transaction as Business Component because pattern will need to insert or delete records to this transaction when associating or disassociating a company to a certain currency.

So, now we insert the association node, like we can visualize below:

AssociationImg04

After we click on 'Add Association Web Panel', the following window will appear:

AssociationImg05

We select CompanyCurrency:

AssociationImg06

Finally we press Select, and an Association Node will be inserted in Company instance, containing all the children, its properties and order from Instance Template, like we can appreciate below:

AssociationImg07

If we execute Preview action over Association node, we will visualize how Association web form will look like:

AssociationImg08

Then, in order to test this functionality we insert a User Action in Selection object's Grid, which will invoke the Association Web Panel as follows:

AssociationImg09

We save the object and watch the results at runtime. The WWCompanies has the action to call to Association Web panel:

AssociationImg10

After we click on this option for Dvelop company, and Association Web Panel is displayed. As it is the first time we access to it, this company does not have any currencies associated.

AssociationImg11

We could associate to Dvelop all the currencies that exist in the system, by clicking in the first button:

AssociationImg12

And we can appreciate that all the currencies are associated to Dvelop. We make the opposite action, by clicking on the last button so to disassociate all the currencies from Dvelop company. 

AssociationImg13

We select the currency 'Dollars' and press the second button, in order to associate this currency to Dvelop (this action also could be accomplished by doing double-click into the currency we want to associate/disassociate).

AssociationImg14

We repeat the procedure above for 'Chile Pesos', 'Euro' and 'Mexico Pesos' and then press 'Confirm'.

AssociationImg15

The application will return to CompaniesWW. Then we select the option to ViewCompany 'DVelop' in order to visualize the results:

AssociationImg16

And we can guarantee that the currencies were correctly associated to 'DVelop'.

If you want to read information about Association Node properties, follow this link: Association Node