Video: Set up a basic component with an If/Then/Else statement: SAP BusinessObjects Design Studio 1.0
We can use If/Then/Else logic in our scripts. In this example, we will adjust the script for the dropdown so that choosing a specific value will change the chart type for the associated chart. Using If/Then/Else syntax, we can construct a conditional statement that will change the chart to a pie chart for the Berlin and Munich sales organizations, and to default to a bar chart for all other sales organizations. Note that we can activate content assistance by pressing Ctrl + Space.
First, we will select the dropdown box, and then add the getSelectedValue method. We can define the sales organization that will trigger the action, in this case, Berlin. Note that we must use the primary key for the selected member. We can also use AND/OR operators in our script. Here, we will add a second statement to apply the same format change for the Munich sales organization. Next, we can define the action to take place when the specified value is selected. Using content assistance, we will select the chart, and then add the setChartType method. Now we will select the appropriate chart type. Finally, we can set up the chart to revert to its default chart type if something other than the specified value is selected. We will use the same syntax as for the pie chart. Note the completed script. Now we will save our changes and execute the application locally to test the script. We will change the sales organization to Berlin. Note that the chart type has changed. Now we will change the sales organization to Munich.
The values change, but the chart type remains the same. Finally, we will select a sales organization that is not set up to change the chart to a pie chart. The chart type has changed back to the original format. We have successfully set up a basic component as a filter with an If/Then/Else statement. Visit www.SAP.com/LearnBI for more tutorials on Design Studio and other SAP business intelligence products..