User Defined Attributes (UDA)

In GXquery, we can create our own secondary attributes involving other attributes in the data model by means of horizontal or aggregation formulas. Because they are global to the metadata, they can be shared with other queries, to the extent that a logical relation exists.

They support all text, numeric, date & time, and nullity functions.

Note

UDAs may only be administered by the metadata’s Administrator user.

Creating a UDA

To create a UDA, select “User defined attributes” in the Start menu.

Gxquery4 - Start menu User defined attributes option

Figure 1

Next, you will see on screen an image similar to the one below.

UDA page

Figure 2

This window represents the extended entities that make up the metadata and are selected to create UDAs. It comprises two regions, one in the upper sector to contain those entities, and the other underneath, to contain the UDAs created for those entities.

For example, in the previous image we can see, in the upper sector, four entities already added: Attraction, CountryCity, Invoice and Passenger. Note that Attraction is the entity selected above, and the lower region is empty, thus indicating that Attraction has no secondary attributes (or UDAs) created.

Let’s now create a UDA to link the customer name, address, city and country. All these attributes are inside the Customer transaction, which is not included in the extended entities region. To create a UDA linked to it we must include it in the list and then press Insert to view the window below.

GXquery4 - Select extensible entity

Figure 3

If we select the checkbox to the left of Customer and press OK, we will see that Customer appears on the list of extended entities. We select it and press Insert in the lower region. With this, we open a wizard that will guide us in making the UDA, as shown below.

GXquery4 - First step in new UDA wizzard

Figure 4

Here we must provide a name and a description, so we enter CompleteCustomer as name and then press Next to open the wizard’s second step.

GXquery4 - Second step in new UDA wizzard

Figure 5

Now GXquery tells us to indicate whether we will be entering a horizontal or an aggregation formula. We leave Horizontal formula as the default option and press Next to access the last step.

GXquery 4 - Entering an expression of CompleteCustmer UDA

Figure 6

As shown in the image above, the following expression has been entered:

CustomerName + CustomerAddress + CountryName + CityName

We will then have to press Finish for the UDA to be saved and permanently linked to the Customer extended entity. The UDA may be included in any type of query.

Note that we have two tools available, Add attribute and Add function, to aid us in the construction.

Add attribute

With this button we can open the full list with all the attributes contained in the metadata, including other UDAs.

Add function

This button unfolds a submenu that proposes the selection of a function based on the attribute type.

String functions Numeric functions Date and time functions Other functions
Lower Int AddMth Null
LTrim Round AddYr IsNull
PadL Trunc EoM  
PadR Val YMDHMStoT  
RTrim   Age function  
Str   Day  
StrReplace   DoW  
SubStr   Hour  
Trim   Minute  
Upper   Month  
Len   Second  
StrSearch   Year  
StrSearchRev   CMonth  
    CDoW