User Tools

Site Tools


An EVENT triggers an ACTION

Intro | Session 1 | Session 2 | Session 3 | Session 4 | Session 5 | Session 6 | Session 7 | Session 8

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:

  • Open a file in a new browser window
  • Update data in or read from a database
  • Read data from a file
  • Perform an error check prior to a submit
  • Refresh images and data generated as results
  • Execute customer-specific actions via the custom code Java API

In Session 3 we added two BUTTONs to the Tree now we add a child ACTION to each BUTTON.

The first ACTION will read the StockData database using SQL statements.


A. Connect a BUTTON to a DATABASE > READ

1. Login, select Stock Screener and open it in the EASAP Builder.

  • On the EASA pages select: EASA > Set Mode > Author
  • Select and open the Stock Screener in EASAP Builder

2. Add DATABASE ACTION and configure its child DATABASE.

  • Expand TABBED PANE LIST > tabbed_pane_Stock_Screener > layout_panel_Actions
  • Right-click button_Search_Stock_Data
  • Select: Child > Add DATABASE ACTION
  • Expand database_action1
  • Rename its child database1 to database_StockData
  • Set Database Name: StockData

3. Add a database READ and configure it to use a SQL template file.

  • Right-click database_StockData
  • Select: Child > Add READ
  • Rename it read_StockData
  • Set
    Outputs: Symbol,Company,Industry,SPIndex,Exchange,Price,Sector, Revenue
    File: read_StockData.txt
    (once this parameter is set the Template Editor will become enabled)

'read_StockData.txt' contains the SQL to read the stock data from the database when button_Search_Stock_Data is pressed.


B. Use the Template Editor to make a SQL query dynamic

1. Add User-specified values to a SQL query , we modify read_StockData.txt with the Template Editor.

  • Select read_StockData
  • From the 'Application' menu: Edit Template…
    …The Template Editor should open as below:

2. Insert object references to the SQL template:

  • Highlight the text 'replace_exchange' near the end of the SQL statement, after: WHERE ID>0
  • Double-click map_Exchange in the DOR list located on the left side of the Template Editor to replace this text
  • Highlight 'replace_sector'
  • Double-click map_Sector on the left
  • Highlight ‘replace_query’ ​text
  • Double-click map_Query on the left

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.

  • Select: File > Save
  • Close the Template Editor

C. Run an initial DATABASE > READ

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.

  • On the Tree right-click tabbed_pane_Stock_Screener
  • Select: Child > Add EVENT PROCESSING
  • Expand event_processing1 by clicking on its
  • Right-click event1
  • Select: Child > Add APPLICATION OPENED
  • Right-click action_group1
  • Select: Child > Add DATABASE ACTION
  • Rename it database_action_On_Open
  • Expand database_action_On_Open
  • Select database2
  • Rename it database_StockData2
  • Set Database Name: StockData
  • Right-click on database_StockData2
  • Select: Child > Add READ
  • Rename it read_Sector_Choices
  • Set
    Outputs:Sector_Choices
    Text: SELECT DISTINCT(Sector) FROM Exchange
    Diagnostics: diag_sectors
    Error Occurred: err_sectors

Text: uses the DISTINCT function to pull out only the single unique value from the Sector column.


D. Working with the results set

1. Populate inputbox_Sector with the LIST Sector_Choices.

  • Expand tabbed_pane_Stock_screener > layout_panel_Container > sub_pane_Filters > inputbox_Sector
  • Select its child DATA VALIDATION
  • Replace ‘Basic Industries, Capital Goods’ text in Source: with %Sector_Choices%
    (ie. when the LIST is accepted the percent signs are removed and the name is colored green)
  • Save the EASAP, click the 'Save' button or type CTRL-s

2. DATA PROCESSING > STATISTICS will provide a dynamic count of the number of stock in the results set from the database.

  • Expand TABBED PANE LIST > tabbed_pane_Stock_Screener > data_processing_Stock_Analysis
  • Right-click SCALAR > map_Query_Report
  • Select: Sibling > Add STATISTICS
  • Rename it count_Symbol
  • Set
    List: Symbol
    Function: COUNT

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.

  • Select layout_panel_Actions > button_Create_Report
  • Set Enable if: count_Symbol>0

4. The list of stock price data should be displayed with a dollar sign and should be rounded to the nearest cent.

  • Right-click on data_processing_Stock_Analysis > LIST
  • Select: Child > Add REPEATED FORMAT
  • Rename it repeated_format_Price
  • Set
    List: Price
    Input Type: Currency
    Decimal Places: 2
    Currency Symbol: $
    Value on Error: NA

5. Company revenue should be displayed as millions of dollars rounded to the nearest million.

  • Right-click repeated_format_Price
  • Select: Sibling > Add REPEATED COMPUTE
  • Rename it Revenue_MM
  • Set
    Value: Revenue/1.E+6
    Type: INTEGER
  • Right-click repeated_format_Price
  • Select: Copy
  • Right-click Revenue_MM
  • Select: Paste (Sibling)
  • Rename it repeated_format_Revenue
  • Set
    List: Revenue_MM
    Decimal Places: 0
  • save the EASAP (any error messages will detail which object and parameter will need to be modified)

6. Add a submit MENU ACTION to button_Create_Report

  • Right-click layout_panel_Actions > button_Create_Report
  • Select: Child > Add MENU ACTION
  • Rename it submit_Run_Report
  • Set Action: Submit
  • Save the EASAP

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.

  • Right-click tabbed_pane_Stock_Screener > layout_panel_Actions
  • Select: Sibling > Add SUB PANE
  • Rename it sub_pane_Search_Results
  • Right-click sub_pane_Search_Results
  • Select: Child > Add TABULATED DATA
  • Rename it tabulated_data_Data_Output
  • Set
    Column Titles: Symbol, Company Name, Industry Name, S&P Index, Exchange, Price, Sector, Revenue ($MM)
    Columns: Symbol, Company, Industry, SPIndex, Exchange, repeated_format_Price, Sector, repeated_format_Revenue
    Width: 1010
    Height: 400

8. Add a LABEL to display the total number of stocks found by the SQL query by displaying the value of count_Symbol

  • Right-click sub_pane_Search_Results
  • Select: Child > Add LABEL
  • Rename it label_Stock_Count
  • Set Label: Total stocks found: %count_Symbol%
  • Save the EASAP

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.

Intro | Session 1 | Session 2 | Session 3 | Session 4 | Session 5 | Session 6 | Session 7 | Session 8