Unofficial Content

Patterns - Work With Pattern



The Work With Pattern is one of the best known and most useful patterns in business applications. IBM was the first company to popularize it, and then, it was rapidly adopted by GeneXus .

It is a User Interface pattern based on what is called 'Object Action Dialogs' (this consists of the user first selecting an object from a list to 'work with it', and then applying an action to it).

In particular, the Genexus Work With Pattern comes built-in with the Patterns Tool so that the Genexus developers can easily apply it to their KBs. Applying this pattern to one or several selected TRNs, all the necessary objects to implement a web application will be obtained (Work With web panels, Views web panels, prompts web panels, etc.).

So, for each selected TRN, this Pattern will generate the following objects:

Work With Web Panel
It's a Web Panel with a grid listing all table records and including the following functionability:




  • Paging
  • Conditional Filters
  • Multiple Orders
  • Control Info for Filter Attributes
  • Standard Actions
  • Export to Excel
  • Save Grid State

Click here to see a Work With Web Panel example

View Web Panel
It's a Web Panel that shows all the information of a record that has been selected in the grid of a Work With Web Panel. It shows the record data in a tab, and it also shows one tab for each subordinated table, containing a grid with the related information.

Click here to see a View Web Panel example

Prompt Web Panel
For each Transaction a Prompt Web Panel is created.

Optional Features




  • Context handling
  • Object level security




Work With Pattern Instance File Nodes

The Instance File defines all the parameters needed to create an instance of the Work With pattern (like for example what attributes will be used in the Work With Form, etc.). Even though the use of this file should be very intuitive, the purpose of this section is to describe all of its the nodes.





Root Node

It has the following attributes:

Folder: Defines the GX Folder where all the generated objects by the Work With Pattern will be stored. The default value can be changed in the Config file.

Update Transaction: As we have been seeing, from one TRN (or all the TRNs that we may want) the Work With pattern creates all the objects needed to obtain a web application. But besides generating new objects, to fully implement the pattern, the involved TRNs should comply with a set of defintions: have the same look and feel as the other objects, include a parm rule, etc. The pattern itself can apply these changes to the TRNs with the objective of relieving the developer from doing it manually and assuring it will comply with all the necessary conditions.

Specifically, the changes to be made to the involved TRNs are:





  • Apply the Theme to the TRN form
  • Associate the Header and Footer Web Components to the TRN Web form
  • Modify or add the parm rule, depending on the Pattern configuration
  • Add the After TRN event with the code required to call the TRN Controller

The Update Transaction property offers the following values, so that the developer can decide what to do:





  • Do not update: Selecting this value, the TRN won't be modified (web form, rules and events are kept).
  • Only rules and events (default value): Selecting this value, only rules and events are modified, but not the web form.
  • Apply WW Style: If this value is selected, the first time the pattern is applied to the TRN the behaviour will be the same as selecting the Create Default value. After the second time, the header, footer and buttons in the web form will be modified, but not the Data Area. Rules and events also will be modified.
  • Create default: If this value is selected, the web form, rules and events will be modified.

Note: Observe that the possible values are ordered in such a way that each one offers to modify something more in the TRN than the one before.

Navigation Group:

This group has the following properties:





  • AfterInsert
  • AfterUpdate
  • AfterDelete

These properties allow to configure what form we want to go to, after making an insertion, an update or a deletion respectively.

For each one of these properties, there is a combo box which offers these values: <default>,<return to caller>,<go to view>,<go to selection>.

For default setting you can set the properties under Navigation node in Workwith.config.






This node is to define:





  • The TRN associated with this instance file
  • Which master page to use
  • The parameters used to call the TRN. By default the defined parameters are: &Mode, PKAttribute1, ..., PKAttributeN

The position of the &Mode (first or last) can be defined in the Config file.

Each parameter has the following properties:
- Domain. In the case the parameter is a variable, the variable Domain must be defined.
- Nullvalue. It allows to define that if an insertion is performed, the parameter must come with a null value. For example, when inserting a Customer whose Customerid has the autonumber property configured, this property should be True.






The instance file will have one Level node for each TRN level.

Each node of this type has the following properties:





  • Name: The default value of this property is the level's base table.
  • Description.

and the following sub nodes:






It defines the TRN's Description Attribute property
DescriptionAttribute can be configured in Genexus 9.0. For previous Genexus versions, the default attribute that is considered with this role is the first non-key attribute of the level base table. Wherever this attribute is present, a link to the View Web Panel will be placed (unless the atribute autolink property is set to false; see 'selection' node for more information).
Since this attribute will have a link attached, it can only be of Edit type (e.g. . not Combo box o check).






See Selection Node






See View Node






See Prompt Node






Defines many options that apply to all instance files, like literals, page size, etc.

This file is located in the PatternsWorkWith directory, under the directory where Pattern is installed.

If you want to have a configuration file per KB, you must copy this file to the Templates directory, under the GeneXus KB directory, so that the tool uses the WorkWith.Config located there. If it is copied under the GeneXus KB directory it can be modified to have different look&feel, languages or messages, etc.
If the tool does not find the Templates directory with the file under the GeneXus KB, the tool will use the WorkWith.Config located in the PatternsWorkWith directory.

The WorkWith.Config determines some general aspects applied to all objects. Ex. the styles to be used in the Web Panels, the Web Components to be used as header and footer, etc.

To edit this file use Tools/Change Pattern Configuration.






In this file you may configure properties such as the following ones:





WW Configuration

This option indicates the classes to be used for the Theme by default. You can use any other class provided all the required classes have been defined.

Page = Page.Rows - Indicates how many rows will be visualized in the grids.
SaveGridState - Indicates whether Orders, Current Page and Filters will be saved for Work With Web Panels or not.
EnableDisablePaging - Indicates whether Paging Buttons are "disabled" when the corresponding action is not enabled (for example, "Next" when viewing the last page) or not.

MaxTabs - Indicates how many Tabs will be visualized in a View. If there are more Tabs than the ones indicated in MaxTabs, a Scroll will be generated to allow browsing through them.






DefaultMode - Indicate whether to include the action in grid by default. Applies to insert, update, delete and display actions.






This property implements Context handling. By default, the implementation includes a variable called &Context based on Context SDT and a procedure called LoadContext, that is invoked in the Start event of each Web Panel. This feature can be used, for example, to keep information about the current user of the application (especially for authentication/authorization purposes), the current company for multi-company systems, etc. It is possible to change the called variable and procedure by modifying the Context section in the WorkWith.Config file.
E.g. You can use Context variable to define a filter: Empcod = &Context.CurrentEmpCod






This property implements object level security. By default, the implementation includes a procedure called IsAuthorized, that is invoked in the Start event of each Web Panel, to control the authorization for accessing the resource. If this procedure returns false, it means that the user does not have authorization to execute the application, and therefore the Web Panel NotAuthorized is called. In the sample implementation this procedure always returns True, you should customize it as needed. It is possible to change the called objects by modifying the Security section in the WorkWith.Config file.





Generated GeneXus Objects

By default this pattern generates the following objects:





  • WW<TRN> Work With WebPanel
  • View<TRN> View WebPanel
  • Prompt<TRN> Prompt WebPanel
  • <XXX>WC A WebComponent with this name is generated for each Tab of type Grid.
  • <TRN>General WebComponent associated to the General Tab.
  • Controller<TRN> WebPanel that controls which object to call in the after trn event.
  • RecentLinks WebComponent to provide the recent links functionality.
  • Header and Footer Web Components added to the form of each one of the consolidated objects.

You can change this names, prefixes or sufixes configuring Prefix property in WorkWith.Config.

See How to Implement Good "Work With" Dialog Boxes in the Web for a presentation on the subject.