Search code examples
ibm-doors

How do you get strip RTF formatting and get actual string value using DXL in DOORS?


I am trying to get the values in "ID" column of DOORS and I am currently doing this
string ostr=richtext_identifier(o)

When I try to print ostr, in some modules I get just the ID(which is what I want). But in other modules I will get values like "{\rtf1\ansi\ansicpg1256\deff0\nouicompat{\fonttbl{\f0\fnil\fcharset0 Times New Roman;}{\f1\froman\fcharset0 Times New Roman;}} {*\generator Riched20 10.0.17134}\viewkind4\uc1 \pard\f0\fs20\lang1033 SS_\f1\fs24 100\par } " This is the RTF value and I am wondering what the best way is to strip this formatting and get just the value.

Perhaps there is another way to go about this that I am not thinking of as well. Any help would be appreciated.


Solution

  • So the ID column of DOORS is actually a composite- DOORS builds it out of the Module level attribute 'Prefix' and the Object level attribute 'Absolute Number'.

    If you wish to grab this value in the future, I would do the following (using your variables)

    string ostr = ( module ( o ) )."Prefix" o."Absolute Number" ""
    

    This is opposed to the following, which (despite seeming to be a valid attribute in the insert column dialog) WILL NOT WORK.

    string ostr = o."Object Identifier" ""
    

    Hope this helps!

    Comment response: You should not need the module name for the code to work. I tested the following successfully on DOORS 9.6.1.10:

    Object o = current
    
    string ostr = ( module ( o ) )."Prefix" o."Absolute Number" ""
    
    print ostr