Triggering context for Events and Rules

Official Content
This documentation is valid for:

Allows you to define specific rules and events for each user interface (Windows or GUI, Web or HTML and Text).

Syntax

EnvironmentAttribute { rule | event } | { { rule … | event … } }

Where:

EnvironmentAttribute
   Specifies the environment attribute used. The possible values are:

  • [win]: Indicates that the events and rules which follow must only be applied to the Windows or GUI forms. In this case, the validation is done the moment the information is saved and sent to the specifier only if the user interface of the associated generator is "Win" type.
  • [web]: The events and rules that follow are only valid for the Web or HTML form. The information is sent to the specifier only if the user interface of the associated generator is "Web".
  • [text]: The events and rules that follow must only be applied to char based user interfaces.
  • [business]: This is the default value and specifies that it applies to all forms; thus, this information is always sent to the specifier. An alternative way to achieve this is to use the previous identifiers concatenated [win] [web] [text].

rule
   Specifies a rule or list of rules (separated by semicolon) associated to the object.

event
   Details an event or list of events associated to the object.

Notes

   There are two possible syntaxes:

  • Individual: This allows you to apply the identifier by event or rule; i.e., individually. To do so you must include the associated identifier and then, in the following line, the rule/event to be executed.
  • By Block: To apply one or several attributes to a group of rules or events, the rules or events to be applied must be enclosed between keys ({ }).

Description

The [win], [web], [text] and [business] environment attributes allow you to discriminate the environment where the related events and rules will be executed. The user can specify the rules and events according to the form.

Due to backward compatibility with Knowledge Bases of previous GeneXus versions, when these identifiers (environment attributes) are not used, the [business] option is assumed by default.

Examples

  • The following examples show in detail the use of the syntax applying to rules/events individually.
[win] // Rule for GUI environments
Noaccept(CliCod) If Insert On AfterValidate;
[win][web] // Event for Win and Web environments
Event Start
       Call( PSettings , &UserId)
EndEvent // Start

The NoAccept rule will only be applied in Windows or GUI environments, while the Start event is valid in Win and Web environments.

  • The next examples show the use of the Block syntax.
[win]
{
parm(&CliCod , &Mode);
Noaccept&CliCod);
CliCod = &CliCod If Update Or Delete;
CliCod = udp( PNumber , ‘Cli’ ) If Insert On AfterValidate;
}
[win][text]
{
Event Start
       Call(PSettings, &UserId)
EndEvent
Event ‘User’ 8
       // User Event
EndEvent
}

The first one specifies that the list of rules within the block delimited by {} must be executed only in Win environments. The other example specifies that the group of events within the block delimited by {} must be executed in Win and Text environments.

Scope

Objects Transaction object, Work Panel object, Web Panel form (rules and events)
Interfaces Text, Web, Win
   

See also

Web Transactions
Transaction rules
Events in Transactions
Web Panel rules


Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.