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

RTC How to add enumeration literal names to a String List using a Script Based Value Set

My client is implementing an RTC configuration that includes the following:

Select a value from Enumeration 1
Populate a Dependent Enumeration 2, based upon the value selected in Enumeration 1 (using a Dependent Enumeration Value Set for this)
Select a value from Enumeration 2
Based upon the value selected in Enumeration 2, populate a String List

String Lists are populated using either Script Based Value Sets or HTTP Value Sets.  What I intend to do is populate the String List from values in another Enumeration (Enum 3) that has no UI presentation of its own.

So, what would the Javascript code look like to do the following:
-  Identify the Enumeration 2 value that has been selected in the UI presentation for Enumeration 2
-  Push externalValue strings from the appropriate Enum 3 literals into the String List?

0 votes


Accepted answer

Permanent link
See
for more examples.

I haven't worked with string lists so far and I am not sure why you would want to use a string list to store enumeration literal id's or display values. For lists of enumeration values RTC provides an enumerationList attribute type for each enumeration.

I am not aware that you can access to the enumeration definition in RTC from the basic JavaScript interface explained in https://jazz.net/wiki/bin/view/Main/AttributeCustomization . For all I know you will have to hardcode all that data somewhere in the script or script configuration.

For that and a host of other reasons, I don't consider the JavaScript attribute customization as a good idea. It is currently way too limited.


You can avoid some of the limitations using Java as explained  in https://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/ . This provides enough common API to access the enumeration definition in the process, I think.
Todd Dunnavant selected this answer as the correct answer

0 votes

Comments

Ralph,

Thanks for the reply. 

The desired end result is to display a multi-select "short list" of the available values from Enumeration 3, based upon a particular value that is selected from Enumeration 2, and to do so as simply as possible.  This would be a trivial thing to do if, for example, String Lists could be populated using Dependent Enumeration Value Sets, but String Lists don't support this approach, I have to use a Script Based Value Set.  I'll explore using an Enumeration List, instead, to see if I can populate this using a Value Set.


2 other answers

Permanent link
Here is what I discovered:

To read the contents of an enum, use the getLabel function (makes no sense, but that is the function you use).

Then, use "push" to load values into your String List.

1 vote

Comments

This means the set function looks at the display value rather than the ID to find the enumeration literal.


Permanent link
When you get to the place to write your own code, just click on "Fill in example" and you should have the very basic code skeleton. For a more detailed example, see the wiki below.
https://jazz.net/wiki/bin/view/Main/AttributeCustomization#API_Example

Note that the above sample also shows you another option to pick your "stored values" in the script configuration, rather than using enumerations.

0 votes

Comments

Hi, Donald,

Thanks for your reply.  I'm familiar with the Attribute Customization example.  Unfortunately, it is very "hand waving", with no concrete examples, regarding how to deal with Enumerations.  I'm hoping that at least one person out in "RTC Land" has successfully created a script based value set that gets an external value from a selected enumeration literal.  I'd like to see that code.

I saw the example regarding how to embed stored values within the process configuration source, and I thought that was slick.  But, in order to determine which values to pick out of the configuration, I still need to know that external value from the enumeration literal.

I wouldn't need to go through the pain of trying to write this script, if a String List could be populated using a Dependent Enumeration value set.  Unfortunately, it can't -- only script based value sets and HTTP value sets can be used, for some reason.

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
× 10,938
× 6,121

Question asked: Apr 21 '16, 11:30 a.m.

Question was seen: 5,388 times

Last updated: Apr 26 '16, 1:50 a.m.

Confirmation Cancel Confirm