Setting an attribute from another attributes value

I am looking to set a value in a column with the value from another attribute such that when attibute As value is requirements.  The value popuated in a different column will be a string value such as Rqt_Value."absolute number".  The output would look like

Requirement Number  |  Description        |  Value                  |

                                     |                            |   Information        |

Rqt_Value.0011           |                            | Requirement        |

                                     |                            | Other                   I

Rqt_Value.0023           |                            | Requirement       |

 

Value is a drop down list

 


DavidGoodwin - Wed Jun 03 14:10:03 EDT 2015

Re: Setting an attribute from another attributes value
llandale - Wed Jun 03 16:10:22 EDT 2015

If you really mean "Column" then you want a layout-dxl column.  that perhaps may look like this:

  • string ReqNo = obj."Requirement Number"
  • string Descr = obj."Description"
  • if (!null ReqNo)       then display "Requirement"
  • elseif(!null Descr)  then display "Information"
  • else display "Other"

-Louie

Notes:

  1. Note that "Requirement Number" and "Description" are actual attributes.  If they are likewise layout-dxl then it gets more complicated as this layout-code as to search for the right "Column" displayed in the "Module", and then retrieve ReqNo = text(obj, colNum).
  2. In this example there is no such thing as a "selectable drop down list" for the "Value" Column; you wouldn't be allowed to select anything anyway (the code decides what to display).  If this were attr-DXL you still would not want to bother making "Value" an enumerated attribute, if the code displays "informatn" instead of "Information" you can fix it.
  3. Looks like "Value" is really "Object Type".  and if so it seems to me you are better off with an attr-DXL (instead of a layout) since "Object Type" feels like  an attribute of the object and in any case feels rather "important" enough that some other code may want to refer to it, such as filtering only for ObjectType == "Requirement".
  4. I wonder if a non-Requirement is "Information" if it is at the top of the module, but is "Other" once you see the 1st requirement.  That gets quite a bit trickier.

Re: Setting an attribute from another attributes value
DavidGoodwin - Wed Jun 03 16:44:25 EDT 2015

llandale - Wed Jun 03 16:10:22 EDT 2015

If you really mean "Column" then you want a layout-dxl column.  that perhaps may look like this:

  • string ReqNo = obj."Requirement Number"
  • string Descr = obj."Description"
  • if (!null ReqNo)       then display "Requirement"
  • elseif(!null Descr)  then display "Information"
  • else display "Other"

-Louie

Notes:

  1. Note that "Requirement Number" and "Description" are actual attributes.  If they are likewise layout-dxl then it gets more complicated as this layout-code as to search for the right "Column" displayed in the "Module", and then retrieve ReqNo = text(obj, colNum).
  2. In this example there is no such thing as a "selectable drop down list" for the "Value" Column; you wouldn't be allowed to select anything anyway (the code decides what to display).  If this were attr-DXL you still would not want to bother making "Value" an enumerated attribute, if the code displays "informatn" instead of "Information" you can fix it.
  3. Looks like "Value" is really "Object Type".  and if so it seems to me you are better off with an attr-DXL (instead of a layout) since "Object Type" feels like  an attribute of the object and in any case feels rather "important" enough that some other code may want to refer to it, such as filtering only for ObjectType == "Requirement".
  4. I wonder if a non-Requirement is "Information" if it is at the top of the module, but is "Other" once you see the 1st requirement.  That gets quite a bit trickier.

I did not explain very well what I am trying to do. The "requirement column" would be an attribute DXL script that would check to see if the " Value" atribute is equal to requirement.  If so the attribute for Requirement number would be a string prefix combined with the absolute number, Otherwise the column would be empty.  What I am thinging is that I create a DXL script in the Requirement Number column. So what I am doing is checking the value of one attribute to set the value of a different attribute.

Re: Setting an attribute from another attributes value
Mathias Mamsch - Thu Jun 04 13:00:54 EDT 2015

DavidGoodwin - Wed Jun 03 16:44:25 EDT 2015

I did not explain very well what I am trying to do. The "requirement column" would be an attribute DXL script that would check to see if the " Value" atribute is equal to requirement.  If so the attribute for Requirement number would be a string prefix combined with the absolute number, Otherwise the column would be empty.  What I am thinging is that I create a DXL script in the Requirement Number column. So what I am doing is checking the value of one attribute to set the value of a different attribute.

I would consider it bad practice to set the value of another attribute from a DXL attribute. It is really hard to check, if the user is really allowed to set the attribute value, e.g. in shared edit mode, read only mode or inside a baseline. Is there a special reason, why you would not simply create a DXL attribute for the requirement number? Regards, Mathias

Re: Setting an attribute from another attributes value
llandale - Fri Jun 05 11:15:13 EDT 2015

DavidGoodwin - Wed Jun 03 16:44:25 EDT 2015

I did not explain very well what I am trying to do. The "requirement column" would be an attribute DXL script that would check to see if the " Value" atribute is equal to requirement.  If so the attribute for Requirement number would be a string prefix combined with the absolute number, Otherwise the column would be empty.  What I am thinging is that I create a DXL script in the Requirement Number column. So what I am doing is checking the value of one attribute to set the value of a different attribute.

While AttributeDXL normally does this:

  • obj.attrDXLName = SomeInfoAbout(obj)

MM is correctly objecting to this:

  • obj."SomeOtherAttribute" = SomeInfoAbout(obj)

That's like chewing gum and drinking milk.

Anyway, if I understand you then you want attribute "Requirement Number" to be attribute-DXL:

  • string Value = probeAttr_(obj, "Value")
  • string Results
  • if (Value != "Requirement") //
  • then Results = " "
  • else Results = "Rqt_Value." Pad_4_digits(int obj."Absolute Number")
  • obj.attrDXLName = Results

You can find a pad function hereabouts.  4 digits isn't enough; go with 5.

-Louie

Re: Setting an attribute from another attributes value
DoorsXLAustralia - Tue Jun 09 06:39:18 EDT 2015

DavidGoodwin - Wed Jun 03 16:44:25 EDT 2015

I did not explain very well what I am trying to do. The "requirement column" would be an attribute DXL script that would check to see if the " Value" atribute is equal to requirement.  If so the attribute for Requirement number would be a string prefix combined with the absolute number, Otherwise the column would be empty.  What I am thinging is that I create a DXL script in the Requirement Number column. So what I am doing is checking the value of one attribute to set the value of a different attribute.

>>I did not explain very well what I am trying to do.

You are not wrong there!

Are you simply looking for an ID column (based on absolute number plus a prefix) which only becomes populated for objects whose value for another enumerated attribute is set to 'Requirement'? (a very common and simple DXL script)

e.g.

if(obj."Object Type" "" == "Requirement")
{
    display "REQ" (obj."Absolute Number" "")
}
 
or just use the module prefix

if(obj."Object Type" "" == "Requirement")
{
    display (identifier obj)
}

 

These are layout DXLs rather than attribute DXLs