Using RPE to hook into Primary Text of linked artifact using DNG
Hello,
I am using DNG 6.0.4 and RPE 2.1.1.
I need to be able to create a report that can hook into the Primary Text of the linked artifact using RPE.
I infer that it requires a container to loop through the links, and also some sort of Data Source Configuration.
I need specific help with this scenario. (What do I loop through in the container, which schemas to use, how to set up the javascript for the URIs in the Data Source Configuration?)
We are using a tailored version of the DNG template that ships with RPE, the one that uses the module and _text schemas.
Thank you,
Linda Roberts
7 answers
If you are starting from DNG_Module.dta, you can add _resources schema (that will be used for linked artifacts). For the _text schema, add a query dataSource/artifact/traceability/links/Link and dataSource/artifact/traceability/links/Link/relation should be used to configure _resources data source.
Set URI to Script Expression
relation.replace("/resources/","/publish/resources?resourceURI=")
From _resources data source, you can print the primary text (in the screen shot, I am printing title).
Links/link will return all links ("Link From", "Link To", etc.). You need to conditionally print the linked artifacts based on the link title (dataSource/artifact/traceability/links/Link/title). You may refer the sample template that prints linked artifacts for the requirements in a module.
Comments
Thanks. Can you please email me the template? I cannot access it.
Unfortunately, that doesn't work either.
Can you please check from another machine?
Thanks,
Prasad (subra.prasad@gmail.com)
I don't know if I can get it from another machine or not, I'll see.
However, I managed to get SOME results from recreating the template from the screenshot.
I put some debug text in the loops to see what was what.
I got results in the Links/link loop (but not in the Links/embedding or Links/Satisfaction loops)
For the Link Title under Links/link I was able to get "Satisfied By" and "Parent Of"
I got no "Satisfies" or "Embeds" or "Child Of" links that I expected to see from my modules. (Nor "Verified by" to my "My Test Case" in QM, I guess that is expected.)
Underneath the _Resources configuration I was able to get the Identifier of the link and the Title of the Link.
However, for Linked "Primary Text" I got <data attribute not found>
Then my template blew up (got corrupted) and I need to recreate it from scratch (so I can't send it to you yet.)
You can mail the corrupted template. Will see if it can be fixed, instead of you creating it from scratch.
I managed to get a copy of the template.
It has a different schema from that in the screenshot above.
When I recreate the screenshot, I can get "Satisfied by" and "Parent Of" links.
When I use the downloaded template that has a _resourceLinked schema, I get "Satisfies", "Child Of" and "Embeds" links.
In neither case do I get primaryText, however.
Finally, success!
It turns out that if you want Primary Text, you have to add another container with the query on dataSource/artifact/primaryText, and then select "_value".
Also, for links in one direction (Satisfied by, Parent of), use the _resources schema.
For links in the other direction (Satisfies, Child of, Embeds), use the _resourcesLinked schema in the sample template in this thread.
Thanks,
Linda
Comments
Rats, not success after all. I celebrated too soon. I was able to get the "_value" of Primary Text into the text container but upon publication, the results were blank.
I believe creating a traceability matrix with Primary Text is critical in many different usage scenarios. It may be that the title is not the same as the Primary Text, so displaying "title" ("Name" in DNG) is not adequate.
The template in this thread only prints the title of linked artifacts. I will provide a modified template that also prints the primary text for linked artifacts.
Hi Linda,
You can refer this updated template. You just need to append ptext=true to the URI so that you can print primary text (dataSource/artifact/primaryText).
Regards,
Prasad
Comments
Thanks Prasad! I can't wait till I can get to an environment where I can download this. I ended up with a solution as well, and am curious how it compares.
Ah, so your trick for getting Primary Text to be accessible included appending to the javascript for the Dynamic Configuration, i.e. relation.replace("/resources","/publish/resources?resourceURI=") + "&ptext=true"
Your template did not work the first time I tested it, but after moving things around inside containers and such, I got it to work. Thanks! My own solution was much more complex. Using + "&ptext=true" simplifies things a lot.
Good to know that you got it working. If you are referring to the sample template, please make sure that you are using modules URI to configure the data source in the following format:
https://<server>:<port>/rm/publish/modules?resourceURI=_c5733113b7694e81b68d23bb6f43e8d0
It took me a long time to figure this one out, though now it seems obvious! (I was in classic DOORS frame of mind then.)
Module links are based on the "about" URI and folder links are based on the "core" URI.
So, when you do the dynamic configuration for folder links, for the _text schema you need to use "core"
using the following arcane incantation, selecting both "about" and "core" in the proper location (dataSource/artifact/moduleContext/contextBinding)
var uri = about
var pos = about.indexOf("/rm/reources");
if (pos>=0)
{
uri = about.substring(0,pos);
uri = uri+ "/rm/publish/text?resourceURI=" + core;
}
uri;.
Comments
Linda Roberts
Apr 02 '18, 6:27 p.m.Thanks. I'm making some progress on this, though I have not completely succeeded yet!. I know I made it to the new part of the template because I got an error about they typo I made in the javascript that resulted in "//"..... (LOL)
After correcting that error and all the other errors I made along the way I finally got no errors but no results either. Does the Links/link go in both directions?
Anjuri Kelaiya
Oct 17 '19, 4:33 a.m.Hello
Linda Roberts
Oct 17 '19, 12:16 p.m.Anjuri Kelaiya
Oct 18 '19, 2:49 a.m.Hello Linda
Linda Roberts
Oct 18 '19, 6:52 p.m.I cannot really send you the template, but I think you need to move your condition to the container that is AFTER the datasource _resourcelinked.