The retrieval of data using AWE can be done from different sources: enumerated, queries, queues, services (Java and C), etc. This helps the integration of client side with the bussiness logic hosted in the server.
AWE's enumerated are useful to manage lists of key-value pairs. They are controlled from Enumerated.xml file which can be found in project's "global" folder.
This file follows this structure:
The Enumerated.xml file should be created in project's "global" folder.
This file must have a header that makes reference to the schema to be followed. You have to make sure that the path is right.
For this tutorial we will use a numeric enumerated as an example, like for instance, "YES-NO" values.
For this, we will add to the file's content the XML tag group with their corresponding options.
Each of the option tags inserted will represent a different element of the enumerated.
The most usual case of use for enumerated is inside of select components.
These are some examples of enumerated:
Variables in AWE are used to make easier data retrieval, allowing to pass values that we have on screen or available in the server (i.e. in a Java service). For instance, if we want to use the value of an onscreen criteria in a where clause, we should use a variable.
In the following lines we will see some examples that will clarify this concept.
Database queries are done from the Queries.xml file. In this file, SQL queries are created using the format given by AWE, and it is its duty to translate them. Like in the previous section, this file should be located in global folder.
Nota: The QUERY concept in AWE's environment makes reference to an action requested to the server where the client expects some data as an answer. Should not be mistaken with SQL QUERY.
Inside of SQL queries, there are several ways of retrieving data: field, computed and compound.
Retrieval with field is used to get fields present in a SQL query, or put in another way, column's values.
In this example, we have a variable with file's identifier in order to obtain it from the table using a WHERE clause. This field retrieved is string type but we trasnform it to a numeric format.
As you can see, we have different attributes that allow to perform several standart SQL operations. For instance, trim attribute.
Database maintains are those actions that perform modifications on stored data, that is, in SQL, actions like INSERT, UPDATE and DELETE. Also, inside of a single maintain several of these operations can be done at one time.
Maintains are created inside of Maintain.xml file and they are found in global folder, like we have seen previously.
Inside if the file, maintains should be defined with target tag.
In this INSERT example, a row is inserted into AwePro table. Field IdePro is filled with AWE's sequence ProKey.
Here you can see a modification (UPDATE) over the same table.
In the following example with a DELETE action, we can se how one of them is performed first and before the second starts a confirmation (commit) of the first operation. If no explicit commit is declared, it will be done anyway but after all operations defined inside the target tag.
Along with this, you can see below an example using the multiple attribute. When set to true it means that IdePro variable is a list of values so there will be executed as many DELETE actions as elements are in that list.
Finally, you can also use maintains of type multiple, that is, XML tag is multiple. This means that actions that can be performed are any of those 3 (INSERT, UPDATE, DELETE). The way of knowing what kind of operation we want to perform is via an implicit variable generated automatically that contains this information. The name of this variable is grid_name-RowTyp and the way to bind this maintain with a grid is with the grid attribute (in this example, GrdScrAccLst).
AWE has the capability to send emails in a easy way. These email deliveries can be defined in Email.xml file.
The most common way of sending an email would be with an action inside of a maintain.
Queue connections through AWE are defined in Queues.xml file inside of project's global folder.
The main two parts of the definition of a queue are the definition of the request and response messages.
Here we can see some examples:
Services defined in AWE, inside of Services.xml file, can be invoked from a query (Queries.xml file) or from maintains (Maintain.xml file).