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

How to read string to text field from enumaration using calculated value in RTC

Hi Team,

RTC version 6.0.2 and using calculated Value.

I want to read string to small string field from enumeration based on user selection.

For example, if I selected value in enumeration as [aaaaaaa bbbbbbbb ccccccccc] and I should only read  "aaaaaaa"  from enumeration to small string field. I was able to read entire value([aaaaaaa bbbbbbbb ccccccccc]) using getLabel() but I am unable to read string position. Something wrong with my code, can you please help here.

Here is my code.

dojo.provide("com.example.programid");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

(function() {

 var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
 dojo.declare("com.example.programid",null, {
    getValue: function(attribute, workItem, configuration) {

   var ppmoprj;

            ppmoprj = workItem.getLabel("com.attribute.ppmoprj");
            var partialStr = ppmoprj.substring(2, ppmoprj.indexOf("]"));
            var res = partialStr.substring(0, partialStr.indexOf(" "));
            //var res = ppmoprj;
   return res;
    }
    });
})();      

0 votes



2 answers

Permanent link

I'm not sure why you would get a list instead of a plain string when reading the label of an Enumeration attribute. Are you really sure it's Enumeration, not Enumeration List?

If you are only asking how to process the string as is, you'd better use the split() function.
https://www.w3schools.com/jsref/jsref_split.asp

0 votes


Permanent link

I think one can learn a lot from this post and the duplicate posts that I think I have seen before.

  1. It is likely an enumerationList attribute type and not an enumertion. e.g. for an enumeration MyEnumeration the type shows in the admin UI MyEnumeration List and not MyEnumeration
  2. Someone who wants to do attribute customization should be aware what they are working against, understand there is a difference and express it in a question
  3. From the documentation https://jazz.net/wiki/bin/view/Main/AttributeCustomization list types (of any type) are not listed as supported in the attribute customization API. there is a list of supported types - enumeration and string/primitive but no lists are mentioned; I can not find out how to retrieve the value as a list; In Java you really get a list with the selected entries; I am not sure how to get it here
  4. Try to look at JavaScript specific sites if you struggle with that.
  5. I would also say know RTC Process Customization – What you can and cannot do 

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
× 6,126

Question asked: Jan 10 '18, 12:32 p.m.

Question was seen: 1,556 times

Last updated: Jan 11 '18, 7:21 a.m.

Confirmation Cancel Confirm