Passing values from dashboard to dashboard with Flash Variables

A common requirement is to be able to have two dashboards interact with each other by passing variables from one dashboard to another. In our example, we have a parent dashboard that encapsulates several children dashboards. In this recipe, we will show you how to pass values from one dashboard to another using Flash Variables.

How to do it...

  1. Open up a new Dashboard model and drag an Input Text component and a SWF Loader component into the canvas.
  2. Go to the spreadsheet and enter Company A in cell A1. This is the default value that will be passed to the second dashboard.
  3. In cell A2 type child.swf?Variable1= and in cell A3 type =CONCATENATE(A2,A1).
  4. Link the Input Text component to cell A1. Also make sure you select the Insert Data On Load option and bind its Destination field to cell A1.
  5. Bind the Source URL field of the SWF Loader component to cell A3.
    How to do it...
  6. Save and export this dashboard to an SWF file. See the Exporting to SWF, PPT, PDF, and other file types recipe in Chapter 9, Exporting and Publishing, for more information. Name this SWF file parent.swf.
  7. Open a new SAP BusinessObjects Dashboards file and drag a Label component into the canvas.
  8. Now bind this Label component to cell A1.
  9. Define this cell as Named Range Variable1. See the Using named ranges recipe in Chapter 1, Staying in Control, for more information on how to do this.
  10. Decrease the size of the canvas by clicking the Fit Canvas to Components option in the Standard Toolbar. You can also find these options in the View menu.
    How to do it...
  11. Your setup should now look like this:
    How to do it...
  12. Now go to the Data Manager. Add a Flash Variables connection.
  13. Click on the Import Named Ranges button. The named range you just created will pop up in the Ranges window. You can now close the Data Manager.
    How to do it...
  14. Save and export the dashboard to an SWF file. Make sure the name of this file is child.swf.
  15. Open parent.swf. Change Company A into another value, click outside the text input box or hit the Enter key, and see what happens.
    How to do it...

How it works...

We just created two dashboards: a parent dashboard and a child dashboard, where the child dashboard is loaded in the parent dashboard with the SWF Loader component. The Source URL in this SWF Loader component not only points to the location of the child dashboard (child.swf) but also contains a variable with a value (?Variable1=CompanyA). With a Flash Variables data connection, the child dashboard is able to read the value from this variable and put it in a spreadsheet cell during runtime.

We used the Excel Concatenate formula, so each time the variable value changes, a new URL is created. The SWF Loader reloads the child dashboard whenever the Source URL changes.

There's more...

Using more than one variable is easy. Just repeat the steps of this recipe and make sure you separate the variables with an ampersand (&). For example, a URL with two variables would look like this: child.swf?Variable1=Value1&Variable=Value2.

There's more...

Besides using more than one variable, it is also possible to pass multiple values through a single variable as described in the following steps:

  1. Reopen the child dashboard you created earlier.
  2. Open the Data Manager and select the Flash Variables connection you already created.
  3. Change the Variable Format from XML to CSV.
  4. Bind the Range of Variable1 to cell A1:A3. Close the Data Manager.
    There's more...
  5. Replace the Label component with a Spreadsheet Table component.
  6. Bind this Spreadsheet Table component to cells A1:A3.
  7. Export the dashboard to an SWF file again. Name it child.swf.
  8. Open the parent.swf file.
  9. Enter multiple values, separated by a comma (,), and see what happens.
    There's more...
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset