Homepage | About EASA | Contact
Practical Session 4 | Practical Session 6
Estimated completion time = 30 minutes.
There are many tools available in EASA to process events and then perform associated actions. By including EVENT PROCESSING in an EASAP, we have the ability to make our user interface be much more dynamic and interactive.
Some examples of situations where processing events will be useful are:
Please follow the instructions below to complete this practical session.
Now we add actions to the BUTTON's we created earlier in the tutorial. The first action will read the StockData database using SQL statements.
Set:
Parameter Name | Parameter Value |
---|---|
Database Name: | StockData |
Set:
Parameter Name | Parameter Value |
---|---|
Outputs: | Symbol,Company,Industry,SPIndex,Exchange,Price,Sector, Revenue |
File: | read_StockData.txt |
Note: The read_StockData.txt
contains the SQL statement for reading the stock data from the database when the button_Search_Stock_Data button is pressed.
To parameterize the SQL query to include the user specified filters created in the previous sessions, we can modify the read_StockData.txt
file with EASA’s Template Editor.
The Template Editor should open like this:
Note: The DOR values are references to the corresponding object values. When the SQL query is used in read_StockData these DORs are replaced with the current values of the objects.
The Template Editor window should now look something like the following with the three DORs shown in bold blue:
Now we proceed to create another DATABASE ACTION→DATABASE→READ that is triggered when the EASAP is opened. This ACTION will read all the unique industry sector names from the database. This list of sector names will populate the DATA VALIDATION under inputbox_Sector.
On the Tree:
Add the ACTION for the APPLICATION OPENED EVENT:
Set:
Parameter Name | Parameter Value |
---|---|
Database Name: | StockData |
Set:
Parameter Name | Parameter Value |
---|---|
Outputs: | Sector_Choices |
Text: | SELECT DISTINCT(Sector) FROM Exchange |
Note: The Text: parameter uses the DISTINCT function to pull out only the single unique value from the Sector column.
Now we populate inputbox_Sector with the Sector_Choices LIST.
Parameter Name | Parameter Value |
---|---|
Source: | Sector_Choices |
We have configured the EASAP to read data from the database, and now we need to process that data by revisiting the DATA PROCESSING branch.
Set:
Parameter Name | Parameter Value |
---|---|
List: | Symbol |
Function: | COUNT |
Note: count_Symbol will have a value of the number of stocks returned by the SQL query performed from pressing the button_Search_Stock_Data BUTTON.
Now that we've defined count_Symbol, we can add logic to button_Create_Report to be enabled only when the count_Symbol SCALAR is greater than 0.
Set:
Parameter Name | Parameter Value |
---|---|
Enable if: | count_Symbol>0 |
In order to improve the formatting of some of the stock data read from the database, we can now add some list objects to the data_processing_Stock_Analysis→LIST branch.
Set:
Parameter Name | Parameter Value |
---|---|
Value: | $ %Price 3.2f% |
Parameter Name | Parameter Value |
---|---|
Value: | Revenue/1E+6 |
Type: | INTEGER |
Set:
Parameter Name | Parameter Value |
---|---|
Value: | Revenue_MM==0 |
Set:
Parameter Name | Parameter Value |
---|---|
Value: | $ %Revenue_MM% |
Set:
Parameter Name | Parameter Value |
---|---|
List: | Zero_revenue |
Inputs: | 0.0,1.0 |
Outputs: | %repeated_Revenue%, N/A |
Delimiter: | % |
Output Expansion: | REPEATED EXPAND |
Add a Submit ACTION to button_Create_Report:
Set:
Parameter Name | Parameter Value |
---|---|
Action: | Submit |
At this point, the stock data is ready for display within the user interface of the EASAP. To display the results from read_StockData we use a TABULATED DATA to create a table and populate it with the stock data.
Set:
Parameter Name | Parameter Value |
---|---|
Column Titles: | Symbol, Company Name, Industry Name, S&P Index, Exchange, Price, Sector, Revenue ($MM) |
Columns: | Symbol, Company, Industry, SPIndex, Exchange, repeated_Price, Sector, repeated_Revenue |
Width: | 1010 |
Height: | 400 |
Now we will add a LABEL to display the total number of stocks found by the SQL query by displaying the value of count_Symbol.
Set:
Parameter Name | Parameter Value |
---|---|
Label: | Total stocks found: %count_Symbol% |
At this point, the EASAP tree should look similar to the following:
After clicking on the Test Web Browser button (), the EASAP should look like this:
We have now completed Practical Session 5 and either proceed to the next session or take a break and exit out of EASAP Builder.
At this point, the application should query the database and allow filtering of results. All that remains is the report generation.