It's all about the answers!

Ask a question

How do I output a multi-valued custom attribute in DNG using RPE?


Janet Charbonneau (852454) | asked Jul 12 '18, 4:49 p.m.
I am currently using DNG 6.0.4 and RPE 6.0.5 (to be able to output directly into Excel).  I have a custom attribute called Variant which is a multi-valued attribute from an enumerated list.  I have filtered using the attribute dataSource/artifact/collaboration/attributes/objectType/customAttribute with the script name == "Variant".  I then assign the variable DNG_Variants to be dataSource/artifact/collaboration/attributes/objectType/customAttribute/literalName.  RPE is only outputting one line for each requirement with only one Variant on the line, even when there are 4 Variants selected for that requirement.

I found an article that said that you have to use a variable to assign the list of Variants to that one variable and then output the variable.  However, it did not show the script of how this is done.

Does anybody know how to modify the RPE template to be able to output the multi-value custom attribute with all of the multiple values on one line of output?

Accepted answer


permanent link
Subramanya Prasad Pilar (4.6k15) | answered Jul 13 '18, 2:31 a.m.

Did you try printing the attribute directly? Are you using an array for assigning the values? You can also try appending the enum values to RPE variable so that it is not overwritten.

Janet Charbonneau selected this answer as the correct answer

Comments
Janet Charbonneau commented Jul 13 '18, 8:46 a.m.
I just tried printing the attribute directly instead of assigning it to a variable and printing the variable.  When I print it directly, I do get all of the Variants, but they are printing in different columns/cells.  I looked at the output in both Excel and Word.  I need to have them print into one cell, preferably in Excel output format because of the large number of columns in the output.

I am not using an array for assigning values.  I have not used an array before in RPE, so would need more info on how to do that.

I am not familiar with appending the enum values to a RPE variable.  Can you give me more information on that, including an example if possible?

Thanks!

Janet Charbonneau commented Jul 16 '18, 12:25 p.m.
Printing the attribute directly did print out all of the values, but they were in different cells.  I then added a container to my cell and put the text boxes within that container.  All variants are now in the same cell.  I also added a delimeter variable which is originally set to null and then within the container, I set it to a comma.  This allowed my output to be V1, V2, V3, V4 with commas separating it correctly.  Here is what my template looks like:


Thank you for your assistance!

One other answer



permanent link
Subramanya Prasad Pilar (4.6k15) | answered Jul 14 '18, 11:07 a.m.

To print all of the Variants in a single column, you can use the query within the Text element as in the screenshot.


However, if you want them to be formatted (with comma separated), you can use simple assignment (through JavaScript Code):
DNG_Variants = DNG_Variants + ", " + literalName;

You may need to reset DNG_Variants variable (if generating report for multiple artifacts). Please find a simple sample template for your reference.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.