Variable

VariableImg01

This variable can be based on a domain, attribute, SDT or Business Component, or can be defined as a basic variable. This will depend on the property 'Data Type'. If it is Basic it will be a basic variable and if it is Based on it will request to select a domain, att, etc.

You can make right click over a table or grid and select one of these options:

VariableImg02

Variable:

Inserts a basic variable which you define directly in the variable node.
 

VariableBasedOn:

Inserts a variable based on an attribute, domain, SDT, Business Component (BC) or External Object.
 

When you insert a variable based on node, by executing Add -> VariableBasedOn in any Table (like the image below), it will appear a Window where you should select in which attribute, domain, SDT o business component the variable will be based on:

VariableImg03

Variable Node has the following properties:

Category Property  
General Properties Name VariableImg04
Description
Inivite Message
Right Text
Help Text
Read Only
Is Required
Is Required Extra Condition
Is Required Error Message
Type Definition Data Type
Domain/Attribute/SDT
Field Specifier (SDT Item)
Type
Form Theme Class
Description Theme Class (only in not responsive KB)
Visible
Visible Condition
Mask
Control Info Control Info
Control Info based on
Conditions (Dynamic Forms)
Control Type
Custom Properties Custom Properties
Location In Father Table Cell Width (Extra small)
Cell Width (Small)
Cell Width (Medium)
Cell Width (Large)
Visible (Extra Small)
Visible (Small)
Visible (Medium)
Visible (Large)
Cell Theme Class
Align
Start Col/Fst Avail
Show Description
Description Width
Description Position
Merge With Previous Cell
Advanced Security Show/Hide Security Functionality Key

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

General Properties

Name:

Variable´s name. This property is required as to identify it on the form, Rules and Events.


Description:

Variable´s description. Represents the caption of the textblock which will appear next to the variable itself in the form if Show description property is True. (This is illustrated below).

 

Invite Message:

Specifies a message that will be displayed in the variable's field in order to describe what you should fulfill on it. When the end user starts to write something on the variable the message disappears. It is supported only when property 'Document type' property of the KB is HTML 5.

Example:

VariableImg05

Right text:

Represents a label that will be inserted next to the variable if this property is not empty, in the same cell as it. The theme that will be assigned to this label will be taken from WWP Configuration -> Theme -> Att/Var Right text. An example of this property can be seen on same property of  Attribute


Help Text:

Specifies a description that will be displayed as a tooltip when positioning the mouse/cursor over the variable's field, over its description or over a help icon next to the variable (depending on the main configuration).
 

For example, if the configuration is set to show tooltip on values, and the following image contains the variable 'Last Name', the tooltip will be displayed as follows:

VariableImg06

More information about this feature: Tooltip Help for attributes and variables

Read Only:

Specifies whether the variable will be read only or not. When the variable is inserted in transaction, it will add the Accept(att) rule, and otherwise will set its property ReadOnly direct in the form.

Is Required:

Specifies whether the variable will be required in the Web Form where it is added. If the variable is required, a special theme class will be assigned, and a verification that this variable has value will be done.
 

Depending on the property 'Required Themes Assignation' will be whether the variable will have assigned the theme class that is defined on the Settings or if this will act as a prefix to the theme class defined on the variable itself.

VariableImg07

Here you can visualize the subroutine that is added automatically for checking the value of all the required variables:

VariableImg08

Then, in the action where you want to check that all the required variables have some value you should call the subroutine and make what you want to do only if the variable &CheckRequiredFieldsResult is true:

VariableImg09

Is Required Extra Condition:

If the Is Required property is set to 'true' you can set a condition in order to specify when the variable would be requiered or not.
 

For example, if we want the person Home Telephone Number to be required when the Cellphone Number is empty we should add the following condition:

VariableImg10

Then, you should use the 'CheckRequiredFields' subroutine in the same way as explained before.

Is Required error message:

Specifies the message that will be displayed when the end users leave the field empty. The value '<default>' will take the message from WorkWithPlus Settings ->> Labels ->> Required Attribute (using Description of the attribute). When the property value starts with Corchete and ends with Corchete1 the message will not be surrounded with " when inserting it in the rules, so that you can include variables and procedures in your error message. For example:

Value of property: Corchete"Home Telephone Number (" + &Pgmname + ") is required"Corchete1 will insert the following msg in the Sub 'CheckRequiredFields':

VariableImg11

Value of property: Home Telephone Number is required will insert the following msg in the Sub 'CheckRequiredFields': 

VariableImg12

Properties of Category Type Definition:

The properties inside this category refer to the variable's type.

Data Type:

Specifies whether the variable will have a basic type (value Basic) or whether it will be based on some attribute, domain, SDT or BC (value based on).

Depending on the value of Data Type property some properties are visible or hidden automatically.
 

Type Definition: Based on

VariableImg13

Domain/Attribute/SDT:

Specifies the domain, attribute, SDT or business component on which the variable will be based on. This property is required in order to define the variable in the generated object (Transaction, Selection, View, etc.).


Field Specifier (SDT Item):

Defines the field specifier which this variable represents. Only applies for SDTs. For example if you have an SDT which contains 3 elements: Id, Name, Description and you create a variable based on this SDT, you can have three variables, one with each element of the SDT so that you can show them on the form. 
 

Type Definition: Basic

VariableImg14

Type:

Specifies the type of the variable. Most of the GeneXus possible types are supported by this property:

VariableImg15

Depending on which type you have selected, some other properties will appear. For example, if you select Numeric type you have the option to define the amount of decimals, and if you select Varchar you have the length of it.

The option "DVelop Combo" allows you to define a new kind of combo with advanced features. You can read more about this in the following link: DVelop Combo


Properties of Category Form:

Theme class:

Variable's theme class.


Description Theme class (only for not responsive):

 

Theme class of the description of the variable (textblock which will appear next to the variable itself). 


Visible:

Specifies whether the variable will be visible or not on screen.

 

Visible Condition:

Specifies a condition so the variable would be visible only if that condition is verified.

For example, if we want to show the variable &PersonHairStyle if the person is a Female we should add the following condition:

VariableImg16

So, if "Male" is selected on the Gender variable the Hair Style won't be visible:

VariableImg17

If we select "Female" the Hair Style variable appears:

VariableImg18

 

Mask

Possible values:

  • IP Address
  • Thousand separator
  • CPF
  • CNPJ
  • CPF or CNPJ

For more information visit Mask.

 


Properties of Category Control Info:

The properties inside this category refer to the variable's control type.

 

Control Info:

Specifies whether the variable will have a specific control type based on some domain/attribute, etc or will be defined customized. If you leave this property in its default value (based on) with empty value in 'Control info based on' property the control type of the variable will be the same as its definition.

Depending on the value of 'Control Info' property some properties are visible or hidden automatically.

Control Info: Based on

VariableImg19

Control info based on:

Specifies the domain or attribute in which the variable's control info will be based on.


Conditions (Dynamic controls):

Specifies the conditions to be added to the control (only if the control is Dynamic Combo, Listbox or Suggest).


Control Info: Custom

VariableImg20

Control Type:

Specifies the variable's control type.

Most of the options that GeneXus allows for control types are supported in this property:

VariableImg21

Depending on the control type selected, other properties may appear. For instance, if the control type is Combo box, the properties Values and Empty Item will be visible.
 

Properties of Category Custom Properties:

Custom Properties:

Gives the option to assign specific properties to variables, properties that are not available within the variable node. This should be used in just a few cases. Detailed info: Custom Properties for Grid, Attributes and Variables

 

Properties of Category Advanced Security:

The properties within this category are only visible when the application has advanced security or is integrated with GAM Security.
 

Show/Hide Security Functionality Key:

Specifies the name of the permission that the variable will have for defining whether that variable will be visible for some role. If the value is empty, it won't add show/hide security to the attribute in this object.

It is important to have in mind that every time that we change some 'Security Functionality Key' and we want to impact these changes in the application at runtime, we have to follow the steps of the section Update Security Functionalities of Advanced Security or GAM (depending on the Security that we have enabled):

Then, at runtime, the administrator will configure the security of the attributes for each role, in the same way that he configures the whole application security (security for objects, modes of a transaction, etc).

If you want to read information about the Location in father table - description properties, follow this link: Location in father table - description

An example of using SDT based on variables could be the following:

I need a web panel where user will insert values to some filters, and the he will press "Generate PDF" and this web panel invokes a procedure that will receive all the filters and will generate a PDF report with the correct information, taking into account the filters that user added in the web form. In this case, developer could create an SDT which contains all the filters, present them on screen and send by parameter this variable to the procedure. This has the benefit that if developer wants new filter on screen will not have to change the parameter rule of procedure, but it will just need to modify the SDT definition and present the new property on screen. Also, with this solution if developer wants to pre load the values of the filters just need to load the SDT values, or receive it pre loaded. There is an example of this below:

VariableImg22

And when user inserts all filters he wants (in this example he inserted Gender: 'Female' and Company Name like 'DV') he will click on 'Generate Report', and application will invoke a Report.

In order to do this, first we create an SDT which contains the filters we needed:

VariableImg23

Then, we create a web panel based on EmptyWithTitle template and insert a user action named "Generate" that will invoke to ReportPerson object (set property GXObject: ReportPerson):

VariableImg24

Then we insert a variable, selecting that will be based on SDTPerson, and the pattern will show us a screen where we select which properties of SDTPerson we want to insert as variables:

VariableImg25

If SDT contains collections, this will not be taken into account because pattern does not support this kind of variables (properties of SDT that are collection, or belong to sub levels). We select all the options and press Ok:

VariableImg26

Finally, if we open the Events and visualize the simplicity of it:

VariableImg27

It is also possible to add SDT collections, like the following images:

VariableImg28

VariableImg29

VariableImg30

Interesting links