Topic
5 replies Latest Post - ‏2012-11-21T15:42:36Z by llandale
Bjoern_Karpenstein
Bjoern_Karpenstein
32 Posts
ACCEPTED ANSWER

Pinned topic Diff in DXL Attribute (obj.attrDXLName) without color

‏2012-11-20T20:12:56Z |

Hello!

I want to make a diff in an DXL Attribute. My Problem is, when i do it in the way like in a layout DXL, the colors aren't printed.

In Layout DXL i normally use displayRichTextWithColor() function.

What can i do to see the colors in DXL-Attributes?

Buffer buff1 = create()
                Buffer buff2 = create()
                        Buffer resBuf = create()
                        buff1 = obj.attributeToCompareValueALM
                        buff2 = o.attributeToCompareValueUIT
                        diff(resBuf, buff1, buff2)
                                        obj.attrDXLName =richText stringOf(resBuf)                      
 
                        delete resBuf
                        delete buff1
                        delete buff2
Updated on 2014-01-06T14:48:04Z at 2014-01-06T14:48:04Z by iron-man
  • SystemAdmin
    SystemAdmin
    3180 Posts
    ACCEPTED ANSWER

    Re: Diff in DXL Attribute (obj.attrDXLName) without color

    ‏2012-11-20T22:55:22Z  in response to Bjoern_Karpenstein

    There are 3 different declaration variations for the DXL diff() function.

    The one you have used does not define the mark-up colours and font.

    You need to use the following variant.

    diff(Buffer result, Buffer source, Buffer target, string removeMarkup,insertMarkup)
    

     

    An example using your code would be as follows

     

     

    diff(resBuf, buff1, buff2, "\\cf1\\strike ","\\cf3\\ul ")
    displayRichWithColor(stringOf(resBuf))
    


    This will strike out deleted characters and display them in a red color, and will underline inserted characters and display them in a blue color

    I recommend that you have a look at the DXL Reference manual to learn more about the removeMarkup and insertMarkup arguments. Select Help > DXL Reference Manual from the DOORS Explorer menu, then navigate to the following help section Modules->History->diff(buffer)

     

     

     


    Paul Miller,
    Melbourne, Australia

     

     

    Updated on 2014-01-06T14:48:38Z at 2014-01-06T14:48:38Z by iron-man
    • Bjoern_Karpenstein
      Bjoern_Karpenstein
      32 Posts
      ACCEPTED ANSWER

      Re: Diff in DXL Attribute (obj.attrDXLName) without color

      ‏2012-11-21T06:57:27Z  in response to SystemAdmin

      Hello Mr. Miller.

      Thanks for your reply. I tried to use it as follows, unfortunalety nothing happened:

      Buffer buff1 = create()
                      Buffer buff2 = create()
                              Buffer resBuf = create()
                              buff1 = obj.attributeToCompareValueALM
                              buff2 = o.attributeToCompareValueUIT
                              diff(resBuf, buff1, buff2, "\\cf1\\strike ","\\cf3\\ul ")
                          obj.attrDXLName = richText(stringOf(resBuf));                                                       
                          // displayRich richText(stringOf(resBuf));  
                              delete resBuf
                              delete buff1
                              delete buff2
      

       


      It looks like there is no coloring?

       

      Updated on 2014-01-06T14:48:53Z at 2014-01-06T14:48:53Z by iron-man
      • SystemAdmin
        SystemAdmin
        3180 Posts
        ACCEPTED ANSWER

        Re: Diff in DXL Attribute (obj.attrDXLName) without color

        ‏2012-11-21T07:47:40Z  in response to Bjoern_Karpenstein
        I also cannot get the color to work when using a DXL Attribute. So maybe this is not possible and you have to use DXL Layout.

        I tried to convert one of my DXL Layout scripts that uses the diff() function into a DXL Attribute - but the DXL Attribute will not display the color for deleted text and inserted text.

        DOORS has a Module menu function that converts DXL Layout columns into a DXL Attribute via Tools > Support Tools > Convert Layout DXL to Attribute DXL.

        Even though this conversion tool adds special DXL code to capture the output of the displayRichTextWithColor() function into a buffer, I think that the richText() function used in obj.attrDXLName = richText(stringOf(resBuf)) does not recognize the RTF color commands \\cf1 and \\cf3.
        Paul Miller,
        Melbourne, Australia
        • Mathias Mamsch
          Mathias Mamsch
          1937 Posts
          ACCEPTED ANSWER

          Re: Diff in DXL Attribute (obj.attrDXLName) without color

          ‏2012-11-21T11:10:05Z  in response to SystemAdmin

          In fact there is one supported richText tag, that will add color to a normal attribute: \highlight ... unfortunately this will only set the brackground color of the text, but this is normally better than just underlining or striking.

          Try:
           

          ...
          diff(resBuf, buff1, buff2, "\\cf1\\highlight2 ","\\cf3\\highlight1 ")
          ...
          

           


          Maybe that helps, regards, Mathias

           

           

           


          Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

           

           

          Updated on 2014-01-06T14:49:07Z at 2014-01-06T14:49:07Z by iron-man
  • llandale
    llandale
    2943 Posts
    ACCEPTED ANSWER

    Re: Diff in DXL Attribute (obj.attrDXLName) without color

    ‏2012-11-21T15:42:36Z  in response to Bjoern_Karpenstein
    I don't think you can display color in an attribute like that, although you can in a layout.