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

Session 5: Processing Events and Performing Actions

Estimated completion time → 30 minutes.

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.

Below are some use cases for EVENT PROCESSING,

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

In Session 3 we added two BUTTON's to the Tree now we add a Child ACTION to each BUTTON.

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

  • On the EASA pages select EASA→Set Mode→Author
  • Open EASAP Builder
  • 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 database1 to database_StockData
            • Set→ Database Name: StockData
  • 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 (← setting this parameter will make the Template Editor available)

read_StockData.txt contains the SQL to read the stock data from the database when button_Search_Stock_Data 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 the Template Editor.

  • Select read_StockData
    • In the 'Menu Bar' at the top of the Builder
      • Select Application→Edit Template…

The Template Editor should open like this,

  • Near the end of the SQL statement after 'WHERE ID>0'
    1. highlight the text → 'replace_exchange'
    2. double-click map_Exchange in the DOR list located on the left side of the Template Editor to replace this text.
  • Highlight the ‘replace_sector’ text and double-click map_Sector
  • Highlight the ‘replace_query’ text and double-click map_Query

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 object reference is replaced with that object's current value.

The Template Editor window should now look something like the following with the three object references shown in bold blue:

  • Select File→Save
  • Close the Template Editor.

Let's 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,
    • Right-click tabbed_pane_Stock_Screener
      • Select Child→Add EVENT PROCESSING.
        • Expand event_processing1 by clicking on its .
    • Right-click event1
    • 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.

Let's populate inputbox_Sector with the Sector_Choices LIST.

  • Expand tabbed_pane_Stock_screener→layout_panel_Container→sub_pane_Filters→inputbox_Sector
    • Select its Child DATA VALIDATION
      • Replace the ‘Basic Industries, Capital Goods’ text in Source: with the %Sector_Choices%
        • (ie. set → Source: Sector_Choices)
  • Save the EASAP → Click the Save button or type CTRL-s

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.

  • 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.

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.

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

In order to improve the formatting of some of the stock data read from the database, add a few LIST's to the data_processing_Stock_Analysis→LIST branch.

  • 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
  • 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 by clicking on the Save button in the toolbar.
    • → Any error messages will detail which object and parameter will need to be modified.

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, click on the Save button or type CTRL-s

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.

  • 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,
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_format_Price, Sector, repeated_format_Revenue
Width:1010
Height:400

Let's 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, click on the Save button or type CTRL-s.

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 completed Session 5 and may 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.

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


Page Tools