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

Attribute customization

Hi,

I am trying to add a customized attribute to a work item. I have 3 enumerations created.
Here is the scenario of how i should get my 3rd field value .
enum1 consists of 4 values, enum2 consist of 4 values and enum 3 consist of 10 values

while creating a work item i will select a value from enum1 and enum2, on doing this i should get the 3rd value assigned automatically. How can i do this?

I tried using the value set for dependant enums. only 2 enumerations are mapped with dependency.

Any help will be highly appreciated.
Thanks in Advance.

0 votes



10 answers

Permanent link
Hi Preetam,
For starters you can use the sample provided in the link and start modifying based on your requirement. To extract values from an enums 1 and 2, you could use syntax such as

var enum1= workItem.getValue(WorkItemAttributes.enum1);
var enum2= workItem.getValue(WorkItemAttributes.enum2);

Use these extracted values to define the rules for the value of enum3:
if ((enum1 === "your literal id") && (enum2 === "your literal id")) {
return "literal id for enum 3"; //value for enum3 based on enum1 and enum2

After you have created a calculated value using the script (under Project Config>Configuration Data>Work Items>Attribute Customizations), go to Project Config>Configuration Data>Work Items>Types and Attributes and select your enum3 attribute and associate the calculated value you just created using your script.

Thereafter, the value for enum3 would change automatically based on the rules defined in the script. You do not need to save the work item for this to work.

Let me know if this information is more useful.

Shashank
RTC - Tracking and Planning

Hi shashank,
Thanks for the response.

I have gone through the link u recommended. However it requires some dojo scripts (if I am not wrong).
How can i identify the different syntax required to fetch the value in it?
Also, my doubt which i got after referring the link is, the values for enum1 is selected and vale for enum2 is selected which are not yet saved, then how would these scripts would work for selecting the value for enum3?

1 vote


Permanent link
Hi Preetam,

I tried out the steps in 3.0.1.3 and interestingly, as you pointed out, the enum value is not changing. I was actually on a 4.0 milestone build and it worked fine here.

So for all intents and purposes, I would encourage you to file a defect against 3.0.1 for calculated values. On the other hand if you want to test and see how it works, I would also encourage you to try out a 4.0 beta install from the downloads section.

Shashank
RTC - Tracking and Planning

Here is the script named with extension ".js"

dojo.provide("org.example.workitems.providers.enumcalc");

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

(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;

dojo.declare("org.example.workitems.providers.enumcalc", null,{

getValue: function(attributeId, workItem, configuration) {

var enum2= workItem.getValue(WorkItemAttributes.Coll. Level);
var enum1= workItem.getValue(WorkItemAttributes.Quadrant);

//Use these extracted values to define the rules for the value of enum3:
//if ((enum1 === "your literal id") && (enum2 === "your literal id")) {
//if ((enum1 === "your literal id") && (enum2 === "your literal id"))

if ((enum1 === "value.quadrant.literal.l2") && (enum2 === "collaboration.partner.literal.l2"))
{ return "activity.point.literal.l2";
}
else if ((enum1 === "value.quadrant.literal.l2") && (enum2 === "collaboration.partner.literal.l4"))
{ return "activity.point.literal.l4";
}
else if ((enum1 === "value.quadrant.literal.l2") && (enum2 === "collaboration.partner.literal.l6"))
{ return "activity.point.literal.l8";
}
else if ((enum1 === "value.quadrant.literal.l2") && (enum2 === "collaboration.partner.literal.l8"))
{ return "activity.point.literal.l12";
}

else if ((enum1 === "value.quadrant.literal.l4") && (enum2 === "collaboration.partner.literal.l2"))
{ return "activity.point.literal.l4";
}
else if ((enum1 === "value.quadrant.literal.l4") && (enum2 === "collaboration.partner.literal.l4"))
{ return "activity.point.literal.l6";
}
else if ((enum1 === "value.quadrant.literal.l4") && (enum2 === "collaboration.partner.literal.l6"))
{ return "activity.point.literal.l10";
}
else if ((enum1 === "value.quadrant.literal.l4") && (enum2 === "collaboration.partner.literal.l8"))
{ return "activity.point.literal.l14";
}

else if ((enum1 === "value.quadrant.literal.l8") && (enum2 === "collaboration.partner.literal.l2"))
{ return "activity.point.literal.l8";
}
else if ((enum1 === "value.quadrant.literal.l8") && (enum2 === "collaboration.partner.literal.l4"))
{ return "activity.point.literal.l10";
}
else if ((enum1 === "value.quadrant.literal.l8") && (enum2 === "collaboration.partner.literal.l6"))
{ return "activity.point.literal.l12";
}
else if ((enum1 === "value.quadrant.literal.l8") && (enum2 === "collaboration.partner.literal.l8"))
{ return "activity.point.literal.l16";
}

else if ((enum1 === "value.quadrant.literal.l6") && (enum2 === "collaboration.partner.literal.l2"))
{ return "activity.point.literal.l12";
}
else if ((enum1 === "value.quadrant.literal.l6") && (enum2 === "collaboration.partner.literal.l4"))
{ return "activity.point.literal.l14";
}
else if ((enum1 === "value.quadrant.literal.l6") && (enum2 === "collaboration.partner.literal.l6"))
{ return "activity.point.literal.l16";
}
else if ((enum1 === "value.quadrant.literal.l6") && (enum2 === "collaboration.partner.literal.l8"))
{ return "activity.point.literal.l18";
}
else return "activity.point.literal.l20";

//return "literal id for enum 3"; //value for enum3 based on enum1 and enum2

}
}
});
})();

1 vote


Permanent link
Hi Preetam,

You can achieve multiple enumeration dependency by providing a script based calculated value. In the script you could define rules for the effective value of the third enumeration based on what values you choose for the first two. You can find more information about creating script based calculated values at https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Script_based_calculated_values

Hope that helps

Shashank
RTC - Tracking and Planning

Hi,

I am trying to add a customized attribute to a work item. I have 3 enumerations created.
Here is the scenario of how i should get my 3rd field value .
enum1 consists of 4 values, enum2 consist of 4 values and enum 3 consist of 10 values

while creating a work item i will select a value from enum1 and enum2, on doing this i should get the 3rd value assigned automatically. How can i do this?

I tried using the value set for dependant enums. only 2 enumerations are mapped with dependency.

Any help will be highly appreciated.
Thanks in Advance.

0 votes


Permanent link
Hi shashank,
Thanks for the response.

I have gone through the link u recommended. However it requires some dojo scripts (if I am not wrong).
How can i identify the different syntax required to fetch the value in it?
Also, my doubt which i got after referring the link is, the values for enum1 is selected and vale for enum2 is selected which are not yet saved, then how would these scripts would work for selecting the value for enum3?

0 votes


Permanent link
THank you very much for your prompt reply shashank.

I have written a script to assign the values and have defined as you have mentioned. Let me know if I can send you the script. Although i have assigned the calculated values for the particular enumeration, on selecting the enum1 and enum2 the value is not getting assigned to enum3 by the script.

0 votes


Permanent link
You need not send me the script. For a quick sanity check please ensure the following:
1) You are associating the calculated value provider with the attribute for enum3.
2) You are specifying the dependencies for the enum3 attribute by adding enum1 and enum2 under dependencies
3) You are saving the project configuration (seems obvious but better to check)

If it still doesn't work, please also let me know the version of RTC that you are using.

Shashank
RTC - Tracking and Planning

THank you very much for your prompt reply shashank.

I have written a script to assign the values and have defined as you have mentioned. Let me know if I can send you the script. Although i have assigned the calculated values for the particular enumeration, on selecting the enum1 and enum2 the value is not getting assigned to enum3 by the script.

0 votes


Permanent link
Hi,

I am trying to add a customized attribute to a work item. I have 3 enumerations created.
Here is the scenario of how i should get my 3rd field value .
enum1 consists of 4 values, enum2 consist of 4 values and enum 3 consist of 10 values

while creating a work item i will select a value from enum1 and enum2, on doing this i should get the 3rd value assigned automatically. How can i do this?

I tried using the value set for dependant enums. only 2 enumerations are mapped with dependency.

Any help will be highly appreciated.
Thanks in Advance.


I have 3 levels of dependency in one of our systems..

os, version and technology

os and version are one dependent enum
version and technology are another

create an OS variable from the OS enum
create a version variable from the variable enum, make it depend on OS variable

create technology variable from the technology enum, make it dependant on the version variable

0 votes


Permanent link
Hi Shashank,
Thanks for your suggestions to cross verify.

I have checked all the points you mentioned. after saving only i am trying to create a new work item. still the same result.
I have Eclipse client 3.0.1

0 votes


Permanent link
Preetamk,

Can you post the script you are using? I believe this should work for you and we just need to debug the steps.

0 votes


Permanent link
Here is the script named with extension ".js"

dojo.provide("org.example.workitems.providers.enumcalc");

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

(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;

dojo.declare("org.example.workitems.providers.enumcalc", null,{

getValue: function(attributeId, workItem, configuration) {

var enum2= workItem.getValue(WorkItemAttributes.Coll. Level);
var enum1= workItem.getValue(WorkItemAttributes.Quadrant);

//Use these extracted values to define the rules for the value of enum3:
//if ((enum1 === "your literal id") && (enum2 === "your literal id")) {
//if ((enum1 === "your literal id") && (enum2 === "your literal id"))

if ((enum1 === "value.quadrant.literal.l2") && (enum2 === "collaboration.partner.literal.l2"))
{ return "activity.point.literal.l2";
}
else if ((enum1 === "value.quadrant.literal.l2") && (enum2 === "collaboration.partner.literal.l4"))
{ return "activity.point.literal.l4";
}
else if ((enum1 === "value.quadrant.literal.l2") && (enum2 === "collaboration.partner.literal.l6"))
{ return "activity.point.literal.l8";
}
else if ((enum1 === "value.quadrant.literal.l2") && (enum2 === "collaboration.partner.literal.l8"))
{ return "activity.point.literal.l12";
}

else if ((enum1 === "value.quadrant.literal.l4") && (enum2 === "collaboration.partner.literal.l2"))
{ return "activity.point.literal.l4";
}
else if ((enum1 === "value.quadrant.literal.l4") && (enum2 === "collaboration.partner.literal.l4"))
{ return "activity.point.literal.l6";
}
else if ((enum1 === "value.quadrant.literal.l4") && (enum2 === "collaboration.partner.literal.l6"))
{ return "activity.point.literal.l10";
}
else if ((enum1 === "value.quadrant.literal.l4") && (enum2 === "collaboration.partner.literal.l8"))
{ return "activity.point.literal.l14";
}

else if ((enum1 === "value.quadrant.literal.l8") && (enum2 === "collaboration.partner.literal.l2"))
{ return "activity.point.literal.l8";
}
else if ((enum1 === "value.quadrant.literal.l8") && (enum2 === "collaboration.partner.literal.l4"))
{ return "activity.point.literal.l10";
}
else if ((enum1 === "value.quadrant.literal.l8") && (enum2 === "collaboration.partner.literal.l6"))
{ return "activity.point.literal.l12";
}
else if ((enum1 === "value.quadrant.literal.l8") && (enum2 === "collaboration.partner.literal.l8"))
{ return "activity.point.literal.l16";
}

else if ((enum1 === "value.quadrant.literal.l6") && (enum2 === "collaboration.partner.literal.l2"))
{ return "activity.point.literal.l12";
}
else if ((enum1 === "value.quadrant.literal.l6") && (enum2 === "collaboration.partner.literal.l4"))
{ return "activity.point.literal.l14";
}
else if ((enum1 === "value.quadrant.literal.l6") && (enum2 === "collaboration.partner.literal.l6"))
{ return "activity.point.literal.l16";
}
else if ((enum1 === "value.quadrant.literal.l6") && (enum2 === "collaboration.partner.literal.l8"))
{ return "activity.point.literal.l18";
}
else return "activity.point.literal.l20";

//return "literal id for enum 3"; //value for enum3 based on enum1 and enum2

}
}
});
})();

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: May 09 '12, 5:33 a.m.

Question was seen: 9,160 times

Last updated: May 09 '12, 5:33 a.m.

Confirmation Cancel Confirm