Description
What is an SDT?
It is a simple way of representing data, whose structure is made up of several elements, for example, a customer's data.
SDTs may be used in different ways, because they simplify parameter passage (e.g. they enable sending the client's data in a single variable between objects), simplify XML automatic reading and writing (with higher-level functions), and are used for improving code readability, etc.
1- SDT Creation
An SDT is created as any other GeneXus object, from the Object/New Object menu:
2- SDT Edition
The edition has two sections. One of them stores the object's structure (Structure), and the other one stores the object's documentation (Documentation).
The structure of an SDT may have simple or compound elements:
In the name field, we identify the element, for instance, the client's name. Using the Data type field, we define the element's data type. Possible values are:
- GeneXus basic types (numerical, date, etc.)
- Domains
- Other previously defined structures (another SDT)
The collection field is used for showing whether the element is a list of elements, in other words, a collection.
It is possible to define elements made up of several simple elements. This is the case of the Address. Here, the data type field is disabled.
The SDT editor is similar to the already-known editors used in GeneXus objects. Among its properties, aside from element definition, there is one that allows you to import a transaction's structure to an SDT.
This means that it may create a new client structure
from a transaction:
and the result will be an SDT with the following structure:
b - SDT documentation
It is used for writing a descriptive text of the object.
In the next GeneXus News issue, we will describe other uses of the SDT object, the definition of more complex structures (collections), as well as specification, distribution, and other SDT properties.