Table of contents
Official Content

Patterns allow you to empower your applications even more, automatically.

Applying a Pattern is really easy, and as soon as you do it, GeneXus creates objects, codes and settings to provide interesting behaviors without the need for you to program them.

Look at the Patterns section of a Transaction. For example, in the ProductType Transaction click on the Patterns tab.

ProductType-Patterns Tab-GeneXus Next

Note that two tabs are available on the top, each one offering a different pattern to be applied to the same Transaction.

First of all, choose the Work With for Web tab, to see how simple applying a pattern is, and how quickly you obtain interesting results.

You only have to click on the "Apply on save" checkbox and save.

ProductTypeWWW_Gen_Web

After saving, if you look for the ProductType Transaction in the KB Explorer, you can see that several objects are located below the Transaction:

New WW objects created in Transaction after applying Patterns

They were created by GeneXus when the Work With for Web pattern was applied.

Press F5 to see the new runtime behavior. The Launchpad Tool Window opens. Note that you have a new link titled WWProductType.

WWProductType link after applying Patterns - Next

You're offered to “work with product types” and from there the ProductType Transaction will be called. Click on that link.

WWProductType link after applying Patterns 2 - Next

A page opens displaying all stored product types and providing a wide range of features to manage them.

For example, click UPDATE for the first line:

WWProductType link after applying Patterns Update

The ProductType Transaction opens offering to edit the details of the product type in that line.

Editing Product Type WWforWeb Pattern - Next

Edit the type name and confirm:

GeneXus Next - Cosmetics Product Type Updated for Cosmetics for Teen

After the edition and confirmation, the application returns to the Work With Product Types page:

GeneXus Next - WWProductType - Delete and Insert options

The DELETE link allows to delete the product type in the line.

Meanwhile, the INSERT button located outside the grid, allows to add new product types. By clicking on it, the ProductType Transaction is opened, ready for adding a new product type. Press it in order to enter a new product type (remember in this case it’s only necessary to enter the product type name because you have set the key attribute’s Autonumber property = True):

GeneXus Next - Baby Care items Product Type added

Once again, after the insertion, the application returns to the Work With Product Types page:

DeveloperMenuUpdate4_Gen_Web

Now note that each product type name has a link. Click on the product type: Cosmetics for Teens.

ProductTypeLink_Gen_Next

As you can see below, all the details of the selected product type are displayed in a first tab, and another tab shows the list of products that belong to that product type.

ProductTypeInfo_Gen_Next

ProductTypeInfo1_GeneXus Next

The Product tab was automatically generated because each product type has several related products. If each product type had also several related data of other kind, more tabs would have been generated in order to show each list of data related to the product type.

Now, go back to the Work With Product Types page. Note that it’s possible to search by name. This means that if, for example, the user types “M”, only the product types that begin with this letter will be displayed:

DeveloperMenuSearch_Gen_Next

Go back to GeneXus Next. So far, you have only selected Apply on save in the Work With for Web tab of the ProductType Transaction, and after saving you have seen all the features that are automatically generated. 

Take a look at this configurable tree:

Product Type tree Patterns

It has configurable nodes, sub-nodes and elements, so that you can customize the behaviors to be generated (i.e. change the search criteria). 

What you may not have noticed is that:
1) The Source of the ProductType Transaction now contains rules defined automatically by the Work With for Web pattern as well as code inside the Events section:

PatternGenerated_Gen_Next

Don’t worry about understanding the automatically generated code.

The idea is to take advantage of everything that is generated automatically and quickly.  Anyway, if you continue learning GeneXus, at some point you will understand it.

2)  As already explained, after applying the Work With for Web pattern to the ProductType Transaction, the “Work With Products Types” object automatically generated, calls the ProductType Transaction (to allow inserting product types, etc.). The ProductType Transaction is called with parameters (data that the caller object sends to the Transaction to be known there), so, that Transaction isn’t offered any more in the application executed in the browser. From that moment on, you can execute the “Work With Products Types” object to perform any kind of operation related to the product types (and from there, the Transaction is called when it is necessary).

Now apply the Work With for Web pattern to the Product Transaction, too. As explained before, you only have to open the Product Transaction and select its Patterns section. Then, you have to select the Work With for Web tab, check the option Apply on save and save:

WWProduct_Gen_Next

Press F5. GeneXus proceeds generating the necessary programs and executing the application with the changes.

Click on the link that offers you to “work with products”:

GeneXus Next - WWProduct link in Launchpad

You can see the same query features that you already saw for the “Work With Product Types” page:

DeveloperMenuInsertProduct_Gen_Web

Let’s insert a new product: 

DeveloperMenuInsertProduct1_Gen_Web

After the confirmation, the application returns to the Work With Product page:

GeneXus Next - WWProducts after adding a new product

Since it’s irrelevant to display the product type code in the grid, let’s remove it from the configurable tree which is taken into account to generate this Work With for Web:

WWProductTypeCode_Gen_Next

Press F5 and GeneXus proceeds saving, generating only the necessary programs and executing the application with the changes:

GeneXus Next - WWProducts without the ProductTypeCode attribute on display

Now insert some products in the same consecutive manner as showed before (by pressing the INSERT button that invokes the Product Transaction).

Below is the Work With Products dialog that lists all the products that have been added:

AddedProducts_Gen_Next

Now let's pay attention to the Work With tab offered for each Transaction. 
Let’s apply it to the ProductType Transaction:

ProductTypeWWD_Gen_Next

Note that under the main node (ProductType), there is the List node. If you click on it, you can see at the right window, a grid that has the ProductTypeName attribute inserted in it. 

In contrast to the Work With for Web pattern, in this case, the Layout is already shown instead of seeing a list of attributes to be included in the grid under the node.

ProductTypeWWD1_Gen_Web

Now, look at the Detail node. You can associate the term Detail with seeing the details of a particular line in the list. 

The Detail node is composed of two sections: General and Product.

Like the functionality implemented by the Work With for Web pattern, the General section displays the data associated with the selected product type:

ProductTypeWWD2_Gen_Next

Otherwise, the Product section displays inside a grid all the products that belong to the product type:

ProductTypeWWD3_Gen_Web

After applying this pattern and saving, if you look at the ProductType Transaction in the KB Explorer, you can see now a new object called WorkWithProductType under the ProductType Transaction:

ProductTypeWWD4_Gen_Web

If you look at both objects generated under the ProductType Transaction, you can notice that the WorkWithProductType hasn’t got other objects under it (because it includes different sections to define the entire implementation inside it).

On the other hand, the WorkWithWebProductType, as you have already seen, is a configurable instance; so, you can set and save that instance object and GeneXus generates other objects under it to provide the useful behaviors you have seen.

Obviously, this is just a very simple demonstration and you can achieve much more sophisticated applications.

 

Last update: December 2025 | © GeneXus. All rights reserved. GeneXus Powered by Globant