Stores a set of Parameters, Conditions, Orders, and a Defined By clause in order to invoke it from different queries, calculations, etc. and reuse the same navigation several times.
Defining Data Selectors brings the following advantages:
- Saving and reusing code: You define a Data Selector once and you can use that definition in several places in the Knowledge Base.
- Less maintenance: You change a Data Selector definition in one place and it applies automatically everywhere it is used in the Knowledge Base.
- They facilitate training in GeneXus: They provide code encapsulation and are easy to learn, define, and use.
Consider the following Transaction object:
Customer
{
CustomerId*
CustomerName
CustomerAddress
CustomerStatus //One of the values that it stores is “Active”
}
Note it contains the CustomerStatus attribute. One of the possible values that it stores is “Active”.
Suppose that you need to query the "active customers" (CustomerStatus= “Active”) in many definitions in your KB. For example:
So, it is appropriate to define a Data Selector object with the filter condition and invoke it from the necessary places.
The following image shows a Data Selector named "ActiveCustomers" that defines the proposed filter:
Once the Data Selector is defined, it can be invoked from:
Data Selector Editor
Data Selectors