Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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?

0 votes


Accepted answer

Permanent link

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

0 votes

Comments

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

Permanent link
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.

0 votes

Comments

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

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,029

Question asked: Oct 10 '19, 6:44 a.m.

Question was seen: 2,073 times

Last updated: Oct 15 '19, 1:59 a.m.

Confirmation Cancel Confirm