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

RPE 6.0.6.1 - Iterate though each DNG custom attibute and assign to a variable

 Hi, 


I am trying to iterate through custom attributes in DNG using script expression and assign the value or literal name to an RPE variable for use in the document. 

I have created a container with the custom attribute query

I have created multiple "assignments" in format:
if (name == "My Custom Attribute 1") {
_MyCustomVariable1 = value;
}
However, in debug mode, each time the query goes to the next custom attribute, the value of all the variables are cleared. 

e.g. query is on Atr 1, sets the value of Var 1, then on Atr 2 it sets te value of Var 2, but clears Var 1. 

I think perhaps my script is wrong. Any help?

0 votes


Accepted answer

Permanent link

Nothing wrong in your script. But you should make the variable writes / initialization through JavaScript Code element. Use the same code in a JavaScript Code element and it should work.

Glyn Costello selected this answer as the correct answer

0 votes


One other answer

Permanent link
Glyn,

You should to it different way:

1) Create a condition on a container that when name == "My Custom Attribute 1"

2) Under thins container add next container that is assigning the value to your customer variable.

Be aware the containers can have conditions and assignments except standard code that is executed inside of them.

0 votes

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

Question asked: Feb 12 '21, 11:54 a.m.

Question was seen: 1,036 times

Last updated: Feb 15 '21, 7:01 a.m.

Confirmation Cancel Confirm