How to print "Not set" when there is no value assigned for DNG custom attribute in RPE template?
I am retrieving custom attribute value from DNG into RPE template by using query (dataSource/artifact/collaboration/attributes/objectType/customAttribute/name ) and (dataSource/artifact/collaboration/attributes/objectType/customAttribute/value) which is working fine when the value is true/false.
Now I want to add a condition to print "Not set" when there is no value assigned for that custom attribute. I have tried several things as below,
1.
if(value != "") {
attribute_value = value
}
else
attribute_value = "Not Set"
}
2. provided condition in a container (value == "No value"), print "Not Set" in the text element.
But it is not printing "Not set" in case of no content.
Can anybody please help on this?
|
Accepted answer
If you were to view the actual data returned from the DNG server for your data source, my guess is that it's not returning any information at all for the custom attributes that aren't set. If there's no data there, then the customAttribute query doesn't have anything to look at, and your code doesn't execute.
Try initializing your "attribute_value" variable to "Not Set" before you go into the customAttribute query.
Anjuri Kelaiya selected this answer as the correct answer
Comments
Anjuri Kelaiya
commented Oct 13 '19, 2:24 p.m.
Thanks for your response John.
I tried initializing "attribute_value" to "Not Set" and set the queries, tried different variations but still no luck.
|
One other answer
Hi Anjuri,
is it a boolean attribute?
You could try first assigning the value of the boolean attribute to a string variable.
Then query the value of the string variable instead of querying the value of the attribute.
It should be either 'True', 'False' or blank.
If it is blank then assign the value "Not Set'
Then publish the variable instead of publishing the attribute value.
Comments
Anjuri Kelaiya
commented Oct 15 '19, 1:59 a.m.
Hello Sean,
Thank you so much for your response. Yes, it is a Boolean attribute. I tried initializing variable same as mentioned in https://jazz.net/forum/questions/253483/rpe-dng-how-can-i-access-an-empty-attribute-and-replace-it-with- and it started publishing "Not set" when the value is blank.
Thanks!
|
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.