Configuring Table Actions

LiveView Desktop offers table actions that allow you execute commands from a table. The table actions available in LiveView Desktop are:

  • Open a new LiveView query.

  • Open a saved LiveView query.

  • Open a table or part of a table in a Panopticon Workbook (requires Panopticon Workbook to be installed on the same machine).

  • Open a URL in a browser.

  • Send a tuple to an existing configured data stream.

  • Execute one or more other table actions.

This page describes how to configure table actions. You can configure as many table actions against a specific project table as you like. Once you have configured the actions, you can designate one action as the default table action.

Load and run the Hello LiveView sample as delivered with LiveView, and view the resulting tables with LiveView Desktop. Follow these steps:

  1. Start StreamBase Studio in the SB Authoring perspective.

  2. Load the Hello LiveView sample:

    1. Select FileLoad StreamBase Sample from Studio's top-level menu.

    2. Enter hello in the filter field to narrow the selection.

    3. Select the sample whose description is Shows a simple Hello World application from the TIBCO LiveView category.

    4. Click OK.

    The Hello LiveView sample loads into Studio with the project name sample_lv-helloliveview. If you already have a project folder of that name, Studio adds a counter digit to the folder name and adds a new project.

  3. In the Package Explorer view, select the name of the project, right-click, and from the context menu, select Run AsLiveView Project. The Console view shows several messages as the LiveView Server compiles the project and starts. This startup process can take several minutes, depending on the configuration of your computer.

  4. When you see the message All tables have been loaded in the Console view, start LiveView Desktop with one of the following methods:

    • On Windows and Linux, if your StreamBase Studio sample project folder includes Start LiveView Desktop entries, then a Run Configuration entry was automatically added to Studio when you loaded the sample. In this case, the simplest way to start LiveView Desktop is to invoke RunExternal ToolsStart LiveView Desktop (Hello Sample).

    • On Mac OS X, only if LiveView Desktop is installed in the canonical location in STREAMBASE_HOME/liveview/desktop, you can invoke RunExternal ToolsStart LiveView Desktop (Hello Sample) (OSX).

      Otherwise, use Spotlight or Launchpad to locate and invoke the app named liveview.

    • On Windows, you can also invoke StartAll ProgramsTIBCOLive Datamart n.mLiveView Desktop n.m.

    • On Linux, you can also run the following command:

      /opt/tibco/sb-cep/n.m/liveview/desktop/liveview &

    Any of these methods opens the Connect to LiveView dialog.

  5. In the Connect to LiveView dialog, select the radio button for Download and click Select.

  6. Select the workspace named Hello LiveView and version Latest.

  7. Click OK. This returns you to the Connect to LiveView dialog. The Download field now contains Hello LiveView (Latest).

  8. Click OK.

Open a New Query

The preloaded workspace for the Hello LiveView sample project shows several views. You can configure a table action that runs a new query against an existing table. This example creates a query that returns all rows of toys that have a certain average price or higher.

  1. Right-click in the ItemsSales table in the Tables pane of the LiveView Tables view or right-click in a grid view and select Actions.

  2. In the Table Actions dialog, click the Add button. The Edit Table Action dialog opens.

  3. Name the table action. This example uses New average price view.

  4. In the pull-down menu for Action, select Open new Query.

  5. In the Table field, select ItemsByCatColor. Note this is not the table that is actively selected. This example configures an action against the Items table to run a query against the ItemsByCatColor table.

  6. Select the radio button for Open new view for each unique query.

    This example runs the query and opens the result in a new tab every time the query is run.

  7. In the Query field, enter the following query predicate:

    category = 'toys' AND avgPrice > 10.0
  8. Click OK. The Edit Table Action dialog closes and the Table Actions now displays New average price view (default).

You can now run this action:

  • Double-click any row in the Items table. This executes the default action. In this case, there is only one action configured, so it is the default.

  • Click in any open view of the Items table and select the action name.

  • Right-click any row of the ItemsSales table, select ActionsChooser, and click the action name.

This query will always return the rows that match a fixed value for avgPrice. You can use LiveView's text substitution capabilities to change the query so that it returns all rows with priceAvg that match the value of lastSoldPrice field of the row that you click.

  1. Right-click in the Items table in the Tables pane of the LiveView Tables view or right-click in a grid view and select Actions.

  2. In the Table Actions dialog, click the Add button. The Edit Table Action dialog opens.

  3. Name the table action. This example uses Check average price for a last sold price value.

  4. In the pull-down menu for Action, select Open new Query.

  5. In the Table field, select ItemsInventory.

  6. Select the radio button for Open new view for each unique query.

  7. In the Query field, enter the following query predicate:

    priceAvg > $lastSoldPrice
  8. Click OK.

Now when you execute the action, the query gets the value of the lastSoldPrice field in the table row that you click and compares it to the values of the avgPrice field in the ItemsInventory table.

Open a URL in a Browser

The text substitution functionality can be across table actions, not just in query predicates. This example uses text substitution in the URL field to search the web for a string that you choose from the table.

  1. Right-click in the ItemsSales table in the Tables pane of the LiveView Tables view or right-click in a grid view and select Actions.

  2. In the Table Actions dialog, click the Add button. The Edit Table Action dialog opens.

  3. Name the table action. This example uses Search for a an item.

  4. In the pull-down menu for Action, select Open new Query.

  5. In the Table field, select ItemsSales.

  6. Select the radio button for Open new view for each unique query.

    This example runs the query and opens the result in a new tab every time the query is run.

  7. In the Query field, enter the following query predicate:

    http://www.bing.com/images/?q=$Items

    This query causes Bing to search for images whose name matches the Items field for the row clicked.

Execute Multiple Table Actions

Now that you have created two table actions, you can create an action that executes both actions.

  1. Right-click in the ItemsSales table in the Tables pane of the LiveView Tables view or right-click in a grid view and select Actions.

  2. In the Table Actions dialog, click the Add button. The Edit Table Action dialog opens.

  3. Name the table action. This example uses Run all actions.

  4. In the pull-down menu for Action, select Run multiple actions.

  5. Select the check boxes for Search for an Item and Open new Query.

  6. Click OK.