Background Colors to DXL Attribute

I'm a relatively new DOORS user, and need some help. Any assistance would be greatly appreciated. Onto the problem...

 

I've created a form that does the following:

1) User enters a requirement

2) User rates it on several factors (1 to 10 scale)

3) DXL attribute comes up with a weighted total

4) DXL attribute ranks the requirement (High, Medium, Low) based on the weighted total

 

Many of our Excel templates use colors for easy recognition. My colleagues would like to see High = red, Medium = yellow, and Low = green. This is possible in enumerations, but I'm not sure how to provide this functionality in a DXL attribute. I tried using the background() function, but it appears only to "work" in a Layout DXL. I say "work", because I get grayscale and the text is no longer visible. I need a DXL attribute so I can use the result in an additional column.

 

I provided the explanation to show why I believe that I need the attribute DXL with color. I'm missing the knowledge on how to implement this. Any functions or examples would be very helpful.

Thank you.


blis - Wed Mar 01 10:34:07 EST 2017

Re: Background Colors to DXL Attribute
blis - Wed Mar 01 16:56:49 EST 2017

After a little work, I've got a layout DXL working how I want. This is how I did it (I'm working on an FMEA for those curious):

 

string s = obj."Object Heading"
if (s != "") halt 
int sev = obj."Severity"
int det = obj."Detection"
int occ = obj."Occurence"
int rpn =sev*det*occ
    
if ( sev==null or det==null or occ==null)
{
    display "?"
}
else 
{
    DBE canvs = getCanvas()
    if (rpn <  40)
    {
        background(canvs, 29)//colorGreen
        color(canvs,logicalDataTextColor)
    }
    elseif(rpn <  100)
    {    
        background(canvs, 28)//colorYellow
        color(canvs,logicalDataTextColor)
    }    
    elseif(rpn <  260)
    {    
        background(canvs, 31)//colorOrange
        color(canvs,logicalDataTextColor)
    }
    else
    {
        background(canvs,13)//colorRed
        color(canvs,logicalDataTextColor)
    }
    display   rpn""
}

 

However, I can't get the converted DXL attribute to work. I get the following error:

-R-E- DXL: <Line:89> null dialog element (DBE) parameter was passed into argument position 1
-I- DXL: execution halted

 

Re: Background Colors to DXL Attribute
PekkaMakinen - Thu Mar 02 01:26:33 EST 2017

blis - Wed Mar 01 16:56:49 EST 2017

After a little work, I've got a layout DXL working how I want. This is how I did it (I'm working on an FMEA for those curious):

 

string s = obj."Object Heading"
if (s != "") halt 
int sev = obj."Severity"
int det = obj."Detection"
int occ = obj."Occurence"
int rpn =sev*det*occ
    
if ( sev==null or det==null or occ==null)
{
    display "?"
}
else 
{
    DBE canvs = getCanvas()
    if (rpn <  40)
    {
        background(canvs, 29)//colorGreen
        color(canvs,logicalDataTextColor)
    }
    elseif(rpn <  100)
    {    
        background(canvs, 28)//colorYellow
        color(canvs,logicalDataTextColor)
    }    
    elseif(rpn <  260)
    {    
        background(canvs, 31)//colorOrange
        color(canvs,logicalDataTextColor)
    }
    else
    {
        background(canvs,13)//colorRed
        color(canvs,logicalDataTextColor)
    }
    display   rpn""
}

 

However, I can't get the converted DXL attribute to work. I get the following error:

-R-E- DXL: <Line:89> null dialog element (DBE) parameter was passed into argument position 1
-I- DXL: execution halted

 

DXL attribute can not have background color as Layout DXL does. You can do something with RTF highlight which for some reason works with DXL attributes. To find examples, search in this forum for RTF highlight.

Your canvas is null in DXL attribute, because DXL attribute does not have the concept of a canvas. When using canvases you should check for null canvas before doing operations with them, i.e. "if (!null canvs) background(canvs, 29)".

Re: Background Colors to DXL Attribute
blis - Thu Mar 02 09:25:24 EST 2017

While it's not the greatest, highlighting does work. For those interested, here's how I got it to work:

 

string s = obj."Object Heading"
if (s != "") halt 
int sev = obj."Severity"
int det = obj."Detection"
int occ = obj."Occurence"
int rpn =sev*det*occ

string xColorTable = "{\\colortbl ;"
xColorTable = xColorTable "\\red255\\green0\\blue0;" // red \\cf1 \\highlight1
xColorTable = xColorTable "\\red0\\green255\\blue0;" // green \\cf2 \\highlight2
xColorTable = xColorTable  "\\red255\\green200\\blue0;" // orange \\cf3 \\highlight3
xColorTable = xColorTable "\\red255\\green255\\blue0;" // yellow \\cf4 \\highlight4
xColorTable = xColorTable "}"
    
if ( sev==null or det==null or occ==null)
{
    display "?"
}
else 
{
    if (rpn <  40)
    {
        displayRich xColorTable "{\\cf0\\highlight2  " rpn " \\highlight0 }"
    }
    elseif(rpn <  100)
    {    
        displayRich xColorTable "{\\cf0\\highlight4  " rpn " \\highlight0 }"
    }    
    elseif(rpn <  260)
    {    
        displayRich xColorTable "{\\cf0\\highlight3  " rpn " \\highlight0 }"
    }
    else
    {
        displayRich xColorTable "{\\cf0\\highlight1  " rpn " \\highlight0 }"
    }
}

Re: Background Colors to DXL Attribute
smarti.sj - Thu Mar 02 10:33:29 EST 2017

blis - Thu Mar 02 09:25:24 EST 2017

While it's not the greatest, highlighting does work. For those interested, here's how I got it to work:

 

string s = obj."Object Heading"
if (s != "") halt 
int sev = obj."Severity"
int det = obj."Detection"
int occ = obj."Occurence"
int rpn =sev*det*occ

string xColorTable = "{\\colortbl ;"
xColorTable = xColorTable "\\red255\\green0\\blue0;" // red \\cf1 \\highlight1
xColorTable = xColorTable "\\red0\\green255\\blue0;" // green \\cf2 \\highlight2
xColorTable = xColorTable  "\\red255\\green200\\blue0;" // orange \\cf3 \\highlight3
xColorTable = xColorTable "\\red255\\green255\\blue0;" // yellow \\cf4 \\highlight4
xColorTable = xColorTable "}"
    
if ( sev==null or det==null or occ==null)
{
    display "?"
}
else 
{
    if (rpn <  40)
    {
        displayRich xColorTable "{\\cf0\\highlight2  " rpn " \\highlight0 }"
    }
    elseif(rpn <  100)
    {    
        displayRich xColorTable "{\\cf0\\highlight4  " rpn " \\highlight0 }"
    }    
    elseif(rpn <  260)
    {    
        displayRich xColorTable "{\\cf0\\highlight3  " rpn " \\highlight0 }"
    }
    else
    {
        displayRich xColorTable "{\\cf0\\highlight1  " rpn " \\highlight0 }"
    }
}

Well done - was just trying to figure this out - if you assign obj.DXLattrname instead of the "displayRich" it displays the highlight in the DXL attr column.


Thanks!