DOORS DXL Recreating the Main Column - ibm-doors

I would like to create an DXL attribute in DOORS that contains the same information as the main column.
It is important to maintain the same heading font style in the attribute as in the main column as this is used for automatic creation of "Table of content" in the Word document after DOORS Publish.
I found the below dxl-script on the internet, but getCanvas does not seem to work.
All text are passed fine to my new attribute, but the heading have the same font style as normal text.
if (obj."Object Heading" "" != "")
{
font(getCanvas, level(obj), HeadingsFont)
displayRich(number(obj) " " obj."Object Heading" "")
}
if (obj."Object Text" "" != "")
{
font(getCanvas, level(obj), TextFont)
displayRich(richTextWithOle(obj."Object Text"))
}
Can anyone help?
KR
Klaus

For me, the code actually does work in a Layout-DXL column (which is not a DXL attribute).
if (obj."Object Heading" "" != "") {
DBE dbCanvas = getCanvas()
font(dbCanvas, level(obj), HeadingsFont)
displayRich(number(obj) " " obj."Object Heading" "")
}
My DOORS version is 9.6, although the methods don't seem to be that new, so DOORS version does not seem to be the issue.
If nothing else helps regarding the DXL code, I would suggest that you have a look at your target word document. There, you should be able to control anything you paste into the document via VBA code in a post-processing step. Although I didn't really get, why you are avoiding using the main column for your source content. Are you trying to show content of a linked or referenced module?

Thanks a lot for the answer. It helped me somehow.
My problem was that I was trying to enter the dxl-code in an attribute. I followed your suggestion and made an Layout-DXL Column instead and it worked almost immediately :-)
I ended up with the dxl-code as shown below.
if (obj."Object Heading" "" != "")
{
DBE dbCanvas = getCanvas()
if( dbCanvas != null )
font(dbCanvas, level(obj), HeadingsFont)
displayRich(number(obj) " " obj."Object Heading" "")
}
else
{ // insert rest of text
if ( probeAttr_(obj, "Requirement") == "Requirement" )
{ // insert requirement text from DT module
displayRich(richText(obj."DXL to DT - ID & Object Text"))
}
else
{ // insert rest of text from this module
displayRich(richTextWithOle(obj."Object Text"))
}
}
I would like to have a publish of the Test Procedure where every Test Case starts with the requirement text followed by the test steps necessary to perform the test as shown in Fig 1.
Test Procedure Publish view
The view in DOORS now looks like I want, but I get error when publishing in DOORS.
DOORS publish error
I therefore protected the line "font(dbCanvas, level(obj), HeadingsFont)", but now I get no headings in the Word document and Table of Content is empty.
Word snip
Is there a solution to this?
KR
Klaus

Related

Is there any way to merge fields without adding the doneMatch into the field?

We need to merge two fields into one. In the config, there is a "doneMatch" special string, and this seems to get appended to the merged field. Why is this needed, and is there a way to not have it also appended to the target field?
For example, I have:
src.fieldA = "City"
src.fieldB = "State"
I want to merge these 2 fields into target.fieldA as "City: State". However, what I end up with is "City: State##DONE##" I can change the config file so that it uses a different doneMatch but it can't be null or empty.. so if I changed it to ";", then the resulting field would be "City: State;". I have to have an end done char/string for some reason. What is this used for? If I am synching the fields with newer updates, is it going to detect the previous ##DONE## in the target.fieldA and think it's already done the merge, so would not make any new changes?
Can someone send me more info on this feature?
I have updated the code for v9.0.1 that changes the way that the FieldMerge works. It no longer uses doneMatch and instead requires that all 3 fields are different and then skips if it has already been done.
if (source.Fields.Contains(config.sourceField1) && source.Fields.Contains(config.sourceField2))
{
var val1 = source.Fields[config.sourceField1].Value != null ? source.Fields[config.sourceField1].Value.ToString() : string.Empty;
var val2 = source.Fields[config.sourceField2].Value != null ? source.Fields[config.sourceField2].Value.ToString() : string.Empty;
var valT = target.Fields[config.targetField].Value != null ? target.Fields[config.targetField].Value.ToString() : string.Empty;
var newValT = string.Format(config.formatExpression, val1, val2);
if (valT.Equals(newValT))
{
Trace.WriteLine(string.Format(" [SKIP] field already merged {0}:{1}+{2} to {3}:{4}", source.Id, config.sourceField1, config.sourceField2, target.Id, config.targetField));
} else
{
target.Fields[config.targetField].Value = string.Format(config.formatExpression, val1, val2) + config.doneMatch;
Trace.WriteLine(string.Format(" [UPDATE] field merged {0}:{1}+{2} to {3}:{4}", source.Id, config.sourceField1, config.sourceField2, target.Id, config.targetField));
}
}
https://github.com/nkdAgility/azure-devops-migration-tools/pull/529
Test the field merge with Azure Devops Migration tools, I could also reproduce this situation. The doneMatch field is required in the configuration.json file(##Done## by default).
There seems to be no way to avoid adding donematch to the target field. Since I am not the developer of this tool, I am not sure about the function of this field.
I would like to share a workaround to solve this issue.
Workaround:
You could try to set the " " to the doneMatch field. ( "doneMatch": " ")
For example:
"FieldMaps": [
{
"ObjectType": "VstsSyncMigrator.Engine.Configuration.FieldMap.FieldMergeMapConfig",
"WorkItemTypeName": "*",
"sourceField1": "System.Description",
"sourceField2": "Microsoft.VSTS.Common.AcceptanceCriteria",
"targetField": "System.Description",
"formatExpression": "{0} {1}",
"doneMatch": " "
}
Since the configuration file is a Json file, you could use " " to represent spaces.
Result:
is it going to detect the previous ##DONE## in the target.fieldA and
think it's already done the merge, so would not make any new changes
Based on my test, the ##Done## in the target field will not affect other operations. You can still operate on this field.
Update:
The above method could only work on field type: Text (multiple lines). If the field is other types, this method doesn't work.
You could create a new field(Text (multiple lines)). Then you could set the target field as the new field.
e.g.
"FieldMaps": [
{
"ObjectType": "VstsSyncMigrator.Engine.Configuration.FieldMap.FieldMergeMapConfig",
"WorkItemTypeName": "*",
"sourceField1": "Custom.test1",
"sourceField2": "Custom.test2",
"targetField": "Custom.test3",
"formatExpression": "{0} {1}",
"doneMatch": " "
}

RATIONAL DOORS DXL, transfering a versioned link from a formal module to an other

So, I'm trying to make a formal module merging tool right now, and everything is working so far, except link copy. Here's how we copy
We empty already baselined reception formal module
We copy object with correct hierarchy
Then we should copy links
(Yes, it's more of a destroy and rebuild tool, than merging, but still, end result is the same)
The problem is, for incoming links, I'm told the source object of the link is inaccessible, even though the formal module is loaded, and I can access and do whatever I want with it. Here's the code to copy Incoming Links
for o in entire PRBaseline do
{
//Once current PBS has been emptied, start recovering objects from baseline
print "Inside Object : " o."IE PUID" "\n" ""
//Once current PBS is emptied & reconstructed to this PBS baseline, do links.
Link incomingLink
Link outLink
Object sourceObject
Object targetObject
for incomingLink in all(o <- "*") do //Iterate on all incoming baselined links, and load source module
{
ModName_ srcModRef = source(incomingLink)
Module temp = edit(fullName(srcModRef),true)
sourceObject = source(incomingLink)
Object oPRCurr
print name srcModRef
print sourceObject."IE PUID" ""
for oPRCurr in modOldPR do
{
print "Currently on Object : " oPRCurr."IE PUID" " and object : " o."IE PUID" "\n" ""
if (oPRCurr."IE PUID" "" == o."IE PUID" "")
{
createLinkset(fullName(srcModRef), fullName(modOldPR), "Test")
print sourceObject."IE PUID" "\n" ""
sourceObject -> "/Test_Access/Test" -> oPRCurr
print "Creating link between source object : " sourceObject."IE PUID" " & target object : " oPRCurr."IE PUID" " from" name srcModRef "\n" ""
}
}
}
}
As for outgoing links I'm not even able to recover the target object of the link, even though I've loaded in edit mode the targeted module
// Continuation of preceding code block
for outLink in all(o -> "*") do
{
ModName_ srcModRef = target(outLink)
print name srcModRef " est la cible \n" ""
Module temp = read(fullName(srcModRef),true)
targetObject = target(outLink)
Object oPRCurr
print name srcModRef
for oPRCurr in modOldPR do
{
print "Currently on Object : " oPRCurr."IE PUID" " and object : " o."IE PUID" "\n" ""
if (oPRCurr."IE PUID" "" == o."IE PUID" "")
{
createLinkset(fullName(srcModRef), fullName(modOldPR), "Test")
oPRCurr -> "/Test_Access/Test" -> targetObject
print "Creating link between target object : " " " " & source object : " oPRCurr."IE PUID" " from" name srcModRef "\n" ""
}
}
}
I'm sorry if I'm already asking a question that's been asked before, but I can't figure out why it doesn't want to work, and I've tried a lot of solutions already.
So, I actually found the answer after a whole lot more of digging. I'll post it below to help people that need to do this.
So, first of all, regarding incoming links the problem to not having access to the link was actually that I recoverd the baseline object, and not the current version object, like that, I was therefore only able to recover info, not edit the object (As it should be !). Therefore the solutionn should be then to actually open the CURRENT module, and find the object via a comparaison key (I hope you have a way to find the object back). Afterwards, I just proceed as before, with the only difference being that I have the current object, and not it's baselined counterpart.
For outgoing links, the matter was a little trickier, I was able to recover my target module name BUT I couldn't load objects from it for the life of me. The problem was, that you have to actually open the baselined module, to recover the baselined object, to recreate the link. To do so, I loaded it like this (know, that I'm iterating on Baseline Sets in this code, that's what the bs variable is)
Module temp = load(test,baseline(major bs, minor bs, suffix bs), true)
and proceeded as before. Now the scripts works perfectly well, so if you need precisions on the way I do this, feel free to ask below, I'll answer to the best of my capacity.

New line character in Information Message in SAP v730 (via message class)?

I want the Information Message to show two lines of text.
Can this be done using one message class statement. Ex.
MESSAGE i001(z56_myclass) WITH lv_cust_id.
I tried putting the string of the short text with characters \n # \r \\n etc. but nothing worked. I don't know how to use long text editor for this particular requirement. Any help would be great.
You can't control the message carriage return in MESSAGE statement.
You can try instead with the following information popup
call function 'POPUP_TO_INFORM'
exporting
titel = 'Information'
txt1 = 'Registration successful'
txt2 = 'Customer Id is 0000001234'.
You have 4 text rows at your disposal (from txt1 to txt4).

Displaying line breaks in the response text

I use Swagger UI v2.2.0. I have a RESTful method which returns plain text. I want to display this text with line breaks.
At the moment, the returned text contains new line characters, but they are displayed as \n. The Content-Type response header is text/plain.
I can return the text with something else inserted of new line characters (e.g., <br> tags). I also can change the Content-Type. I just need actual line breaks in the displayed text.
Is there a way to achieve this?
Not sure if it helps, but I also faced the same issue.
I wanted to execute the following code in nodejs server:
app.post('/xyz', function (req, res) {
res.status(400).send("MyError\nMyErrorStack:\nStackLine1\nStackline2")
}
and wanted output like:
"MyError
MyErrorStack:
StackLine1
Stackline2"
but got :
"MyError\nMyErrorStack:\nStackLine1\nStackline2"
so instead i split the string into array as shown used following:
err.error = errObj.stack.split("\n")
app.post('/xyz', function (req, res) {
res.status(400).send(err)
}
and this printed
"Error": {
"error": [
"Error: ENOENT: no such file or directory, open 'c:\\....'",
" at Error (native)",
" at Object.fs.openSync (fs.js:584:18)",
" at Object.fs.writeFileSync (fs.js:1224:33)",
" at Object.fs.appendFileSync (fs.js:1283:6)",
" at ...",
" at ...",
" at ...",
" at ...",
" at ...",
" at ..."
]
}
This worked for me.
This is currently not possible due to a documented bug in Swagger UI. Reference:
Inconsistent Markdown Newlines #2981
Bug in Model (Definition) Description with newline characters #3078
The second Issue listed, #3078 contains some discussion on overriding the styles used to render that part of the UI, but results appear inconsistent.
Note: I have subscribed to those issues and will update the answer and/or flag to close as no longer relevant when it is resolved.

How do I know whether I'm looking at a newline or carriage return etc.?

For example, say I wanted to determine whether this form was storing newlines as carriage returns or newlines or whatever characters. I'm often in situations where I'm writing code and am not sure what type of new-line character a file/form/whatever I'm parsing is using.
How could I determine this? Is there a way to determine this without actually doing a check inside of code? (It seems like I should be able to right-click and "show all characters" or something like that).
Note: I realize I could write code saying
(if == '\r') cout << "Carriage";
etc
but I have a feeling there's a simpler solution.
Maybe is list what you are looking for (from vim help):
:[range]l[ist] [count] [flags]
Same as :print, but display unprintable characters
with '^' and put $ after the line. This can be
changed with the 'listchars' option.
See ex-flags for [flags].
You can switch modes with:
:set list
and
:set nolist
Additionally you can use "listchars" as shown in this example:
You could for example check your document for occourences of "Carriage Return" or "New Line"/"Line Feed".
e.g. (php):
if( strstr( $yourstring , "\r" ) != false ){ // You have Carriage return
// Do something
}
elseif( strstr( $yourstring , "\n" ) != false ){ // You have New Line/Line feed
// Do something
}
else{
// You cannot determine which on is used, because the string is single-lined
}
I hope this is the thing you're looking for
Note: In windows "\r\n" is used to specify ne lines

Resources