Search code examples
scriptingibm-doors

How to make a DOORS boolean attribute/column "False" if another attribute/column is not empty with DXL?


I have 2 attributes/columns. "A" and "B". A is as string of text. B is a boolean that can be True or False (when you edit it in DOORS, it's a drop down with 2 options T/F).

I want to use DXL to make B False if A is not empty.

Here's what I have so far, but I'm very new and unsure the syntax:

Object o
for o in current Module do{
 if((o."A") == null)
 {
  o."B" = "False"
 }
}

What I'm doing is I go into edit-mode on the DOORS module, click Edit -> Attributes -> "B" -> Edit... -> check DXL attribute -> Browse... -> New, write the code -> Ok, close all windows, Tools -> Refresh DXL Attributes. Correct?

When I Refresh, nothing happens, also when I clicked "check" after writing the code, there was no errors. Also when I go back the Edit -> Attributes and look back at the DXL for "B", I don't see my script there...


Solution

  • Try this dxl code

    //Go to Edit -> Attributes, select 'B' attribute; select Edit and check the checkbox 'DXL attribute', click the 'Browse' button and paste the following code

    //Press F5 to refresh DXL attributes

    //Or 'Tool -> Refresh DXL attributes' to refresh DXL attributes

     if((obj."A") == null)
     {
      obj.attrDXLName = "False"
     }
     else
     {
       obj.attrDXLName = "True" 
     }
    

    Follow the below steps to see or edit the dxl code

    1. Select the DXL attribute
    2. Click Edit
    3. Check the DXL Attribute box
    4. Click Browse
    5. Click Current