Exercise: Concatenating Values

  To concatenate the values of two text boxes to a third text box:

  1. In Design mode, drag a text box from the Elements pane to the Content pane of a new or existing Dashboard section.

  2. Double-click the text box and change the Name to operand1.

  3. Add a command button to the right of operand1.

  4. Double-click the command button and change the Title to +.

  5. Copy and paste the operand1 text box, move it to the right of the + button.

    The new text box is automatically renamed operand2 by Interactive Reporting.

    Tip:

    Interactive Reporting allows copying and pasting of control objects only when the Console window is closed, and only within the same document section.

  6. Copy and paste the operand1 text box again and move it to the right of operand2.

    Interactive Reporting automatically renames the new text box operand3.

  7. Change the Name of operand3 to txt_result.

  8. Select the + button and choose Dashboard, then Scripts

  9. Add the following JavaScript:

    txt_result.Text=operand1.Text+operand2.Text 

    To avoid typing errors, use the Object browser to navigate to Dashboard Objects, and then select the Text property for each text box. Type only the = and + operators.

  10. Click OK to save the script and close the Script Editor.

    In Run mode, type numbers in operand1 and operand2. They concatenate to txt_result after you click the + button.

    Note:

    The following exercise continues from the previous one, but changes the script to add instead of concatenate strings.