It's all about the answers!

Ask a question

Using RPE to hook into Primary Text of linked artifact using DNG


0
1
Linda Roberts (214) | asked Apr 02 '18, 12:45 p.m.

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


Comments
Linda Roberts commented 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?

7 answers



permanent link
Subramanya Prasad Pilar (3.3k13) | answered Apr 02 '18, 1:35 p.m.

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).


permanent link
Subramanya Prasad Pilar (3.3k13) | answered Apr 03 '18, 2:41 a.m.

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
Linda Roberts commented Apr 03 '18, 11:31 a.m.

Thanks. Can you please email me the template? I cannot access it.



Linda Roberts commented Apr 03 '18, 3:39 p.m.

Unfortunately, that doesn't work either.


Subramanya Prasad Pilar commented Apr 04 '18, 2:17 a.m. | edited Apr 04 '18, 2:28 a.m.

Can you please check from another machine?
Thanks,
Prasad (subra.prasad@gmail.com)


Linda Roberts commented Apr 05 '18, 12:45 p.m.

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.)


Subramanya Prasad Pilar commented Apr 05 '18, 12:51 p.m. | edited Apr 05 '18, 12:52 p.m.

You can mail the corrupted template. Will see if it can be fixed, instead of you creating it from scratch.


Linda Roberts commented Apr 09 '18, 3:50 p.m.

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.

showing 5 of 7 show 2 more comments

permanent link
Linda Roberts (214) | answered Apr 09 '18, 5:53 p.m.

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
Linda Roberts commented Apr 11 '18, 4:54 p.m.

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.


Subramanya Prasad Pilar commented Apr 11 '18, 10:41 p.m.

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.


permanent link
Subramanya Prasad Pilar (3.3k13) | answered May 16 '18, 1:15 p.m.

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
Linda Roberts commented May 16 '18, 1:53 p.m.

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.


Linda Roberts commented May 21 '18, 6:31 p.m.

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.


Subramanya Prasad Pilar commented May 23 '18, 11:34 a.m.

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


permanent link
Markus Klamke (11) | answered Jul 12, 8:39 a.m.
Hello Prasad,

is it possible you upload the updated template to another platform or send it to me via mail?

Regards,
Markus

Comments
Subramanya Prasad Pilar commented Jul 12, 12:08 p.m.

I have uploaded it in Google Drive as well as IBM box. I can mail it in case you cannot access the file.


permanent link
Markus Klamke (11) | answered Jul 22, 6:59 a.m.

Hello Prasad,


I managed downloading the file from google.
Thanks.
Unfortunately it seems this template can only deal with "module" links.
I use also "folder" links but those are not displayed in the ouput file.
Is there a possibility to implemtent this inside the template?

Regards,
Markus


permanent link
Linda Roberts (214) | answered Jul 22, 12:39 p.m.

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;.

Your answer


Register or to post your answer.