It's all about the answers!

Ask a question

Can a JS value provider set an enumeration list attribute?


Luca Martinucci (1.0k291110) | asked Feb 15 '17, 2:41 p.m.

Is it possible to use a JavaScript value provider to automatically set an enumeration list attribute with a list of values (calculated according to some conditions)?
I am working with RTC 6.0.3.


Comments

Luca Martinucci commented Feb 16 '17, 2:59 a.m.

Hi Don,
the discussion does not really answer my question.
I need to know ho to set the values a multi-value attribute using a JavaScript value provider.
To set a single-value attribute, the script must return its (scalar) value.
What kind of variable must be returned when the attribute to set is a multi-value list?

Accepted answer


permanent link
Ralph Schoon (62.3k33643) | answered Feb 16 '17, 3:56 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 As Don mentions from the https://jazz.net/wiki/bin/view/Main/AttributeCustomization documentation does state what is supported and list type attributes are mentioned nowhere. I think the list types appeared in RTC after the main JavaScript work was done.


I have never been able to set any list attributes in JavaScript. 

Luca Martinucci selected this answer as the correct answer

Comments
Luca Martinucci commented Feb 16 '17, 4:03 a.m.

Actually, I suspected that JavaScript was not able to set list attributes.
I will write a Java extension, instead.

One other answer



permanent link
Donald Nong (14.5k414) | answered Feb 16 '17, 12:26 a.m.

Try to set up a Script Based Value Set. And you need to set the attribute using this value set depend on the "condition"/attribute.
https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Script_Based_Value_Set


Comments
Luca Martinucci commented Feb 16 '17, 3:01 a.m.

Donald, actually I am no trying to set a Value Set.
I am trying to set the values of an attribute, an enumeration list attribute.
If I want to insert 3 values into the attribute, what should I do?
I mean, the js Calculated Value script must return a variable containing the value to set.
For a scalar attribute, it is a scalar variable.
What kind of variable can set  a multi-value attribute?
Perhaps this is not possible using JavaScript, and I should instead write a Java extension using the server-side SDK.


1
Donald Nong commented Feb 16 '17, 3:15 a.m. | edited Feb 16 '17, 3:18 a.m.

Ah...sorry for misunderstanding your question. Now you reminds me. IIRC I also had a hard time setting a value of an Enumeration List attribute. I tried CSV, JSON and other imaginable formats but all failed. You don't use a variable, the Calculated Value provider returns a "value" directly. I may give it another crack a bit later.

Edit: Have another look at the API spec. Even Enumeration is "limited support", and Enumeration List is not mentioned at all. So I think it's no go for JavaScript.

Your answer


Register or to post your answer.