Adding text and background colors to a DOORS attribute by using a script

You can use a script to apply background color to cells that contain color data in the output.

Procedure

  1. Drag a table element into the template content editor.
  2. Enter 2 rows and 3 columns.
  3. Drag a query into the table.
    For example, drag themodule query into the query.
  4. Enter the column headings in the first row.
    For example, enter Object Heading, Object Text, and Color as the column headings in the first row.
  5. Drag a query into the second row.
    For example, drag the module/object query into second row.
  6. In the second row, drag attributes into the first two cells.
    For example, drag the module/object/Object_Heading, and module/object/Object_Text attributes into the first two cells.
  7. In the third cell of the second row, drag the module/object/color attribute in.
  8. Select the third cell in the second row.
  9. In the Properties view, select the Color tab.
  10. In the Cell background field, click the ellipsis.
  11. Select the Script expression tab.
  12. Select the attribute that you are applying the script to. Example, module/object/color
  13. Enter the script.
    Example
    if (color == "green")
    {
    "00FF00"
    }
    else if (color == "yellow")
    {
    "FFFF00"
    }
    else if (color == "green,yellow" || color == "yellow,green" )
    {
    "6B7D02"
    }
  14. Click OK.
  15. Generate the output.