It's all about the answers!

Ask a question

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


Glyn Costello (1404554) | asked Feb 12 '21, 11:54 a.m.
edited Feb 12 '21, 11:54 a.m.

 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?

Accepted answer


permanent link
Subramanya Prasad Pilar (4.6k16) | answered Feb 15 '21, 7:01 a.m.

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

One other answer



permanent link
Bartosz Chrabski (3.4k22949) | answered Feb 14 '21, 2:41 p.m.
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.

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.