EVENT PROCESSING provides a way to capture an event and then trigger an action.
EVENT PROCESSING helps our user interface to become dynamic and interactive.
A few use cases for EVENT PROCESSING include:
The first ACTION will read the StockData database using SQL statements.
1. Login, select Stock Screener and open it in the EASAP Builder.
3. Add a database READ and configure it to use a SQL template file.
'read_StockData.txt' contains the SQL to read the stock data from the database when button_Search_Stock_Data is pressed.
1. Add User-specified values to a SQL query , we modify read_StockData.txt with the Template Editor.
2. Insert object references to the SQL template:
Each object reference (historically 'DOR') is a reference to the current value of the named object.
When the SQL query in read_StockData.txt is evaluated each SCALAR reference is replaced with that object's current value.
3. Confirm the Template Editor window looks like the following, the three SCALAR references are bold and in blue.
Add a DATABASE ACTION > DATABASE > READ that is triggered by an APPLICATION OPENED EVENT.
This ACTION will read all the unique industry sector names from the database.
This list of sector names will populate the child DATA VALIDATION under inputbox_Sector.
Text: uses the DISTINCT function to pull out only the single unique value from the Sector column.
1. Populate inputbox_Sector with the LIST Sector_Choices.
2. DATA PROCESSING > STATISTICS will provide a dynamic count of the number of stock in the results set from the database.
count_Symbol will store number of stocks returned by the SQL query after a click on button_Search_Stock_Data.
3. Add logic to button_Create_Report to be enabled only when count_Symbol is greater than 0.
4. The list of stock price data should be displayed with a dollar sign and should be rounded to the nearest cent.
5. Company revenue should be displayed as millions of dollars rounded to the nearest million.
6. Add a submit MENU ACTION to button_Create_Report
At this point, the stock data is ready for display within the user interface of the EASAP.
7. To display the results from read_StockData we use a TABULATED DATA to create a table and populate it with the stock data.
8. Add a LABEL to display the total number of stocks found by the SQL query by displaying the value of count_Symbol
9. Confirm the EASAP Tree looks similar to the following.
10. Click on the 'Test Web Browser' button (), confirm the EASAP looks like this.
We have completed Session 5 and may proceed to the next session.
At this point, the application should query the database and allow filtering of results, all that remains is to generate a report of stocks.