Using formulas and one XML variable to control multiple objects

This example shows how you might use the Formula option on the Availability tab of objects. Here, text box objects are used, but you might use image objects instead.

In this example, a different text box is displayed according to whether Africa or Europe is selected from a combo box. An action on the combo box uses a SETPROPERTY formula to populate an XML variable. In the variable, the key is Visibility, the selected country is a property, and TRUE is the value assigned to the property.

To prevent text boxes remaining visible when a country other than Europe or Africa is selected, the formula sets Visibility to FALSE for all countries.

A GETPROPERTY formula on the Availability tab of each text box returns the key and property from the variable. On one box, the formula extracts the visibility for Europe and, on the other, the visibility for Africa.

An alternative technique would be to hide or show the rows containing the text boxes.

This example uses dimensions of the Analysis cube.

  1. Create a report variable and name it rv_VisibilityXML.
  2. Insert a combo box and link it to the Region dimension. Name the combo box Region.
  3. Open the properties of the combo box and select Perform action when selection changes on the General.
  4. Create a Set parameters action with rv_VisibilityXML as the parameter. Specify this formula as the value of the parameter: =SETPROPERTY(SETPROPERTY(ReportVariables.rv_VisibilityXML.Text, "visibility","*" ,"false"), "visibility",ReportObjects.Region.Alias,"TRUE")
  5. Add two text boxes to the report and add text. For example, Key facts about Africa, and Key facts about Europe.
  6. Right-click the Africa text box and select Format Text Object. Specify this formula on the Availability tab: =GetProperty(ReportVariables.rv_VisibilityXML.Text,"visibility","Africa")
  7. Specify the same formula for the Europe text box, replacing "Africa" with "Europe".