Skip to main content Skip to footer

How to Conditionally Change a Report Control's Properties

Background

With ActiveReportsJS, there are multiple ways to change a control's properties. Controls can be programmatically changed while using the API, designed within our Standalone Report Designer, or conditionally created using the expression editor. For this tutorial, we will walk through the required steps to conditionally format a textbox's background color property through the expression editor.

Steps to Complete

  1. To start, open the Standalone Report Designer. 
  2. Add a textbox to the report's surface. Double click it and type test.
  3. Click on the textbox control again, and on the right side of the designer, select the Properties tab. Scroll down to find the Color property under Background, and click on the gray button that on the right-hand side to select Expression.
  4. Within the expression editor, type the following code to only make the textbox visible when TextBox1's value is equal to 'test':
    {IIF(#TextBox1 = "test", "Green", "Red")}
  5. Exit the expression editor and click Preview in the top-left corner of the designer to see the textbox's background color has changed to green.

 

Christian Wirt