getValueSet script is not returning the values as expected when one attribute dependency is set on two other attributes
RTC 6.0.6.1
There are three enumeration attributes in a project area
Platform Name1 with id listplatformname1
Component Type1 with id componenttype1
Component Name1.
We are trying to do attribute customization so in component name1 field not all the defined enumerations are displayed. Based on the selection of Platform Name1 field and Component Type1 field selection, few enumeration values only should be listed in the Component Name1 field. We created a dojo script for it. But it is not working as expected.
The script
dojo.provide("com.visteon.workitems.providers.componentname1");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.string");
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("com.visteon.workitems.providers.componentname1", null, {
getValueSet: function(attributeId, workItem, configuration) {
var platformname1= workItem.getValue("listplatformname1");
var componenttype1= workItem.getValue("componenttype1");
var componentname= [];
//MediaTek
if (platformname1=="com.visteon.hwps.enum.platformname.literal.l7")
{
//SOC-GIP
if (componenttype1=="com.visteon.hwps.enum.comptype.literal.l4")
(
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l4");
)
//VIP
else if (componenttype1=="com.visteon.hwps.enum.comptype.literal.l7")
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l6");
}
//Memory
else if (componenttype1=="com.visteon.hwps.enum.comptype.literal.l6")
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l8");
componentname.push("com.visteon.hwps.enum.componentname.literal.l10");
componentname.push("com.visteon.hwps.enum.componentname.literal.l12");
}
//Power Strategy
else if (componenttype1=="com.visteon.hwps.enum.comptype.literal.l8")
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l14");
}
//Display Sizes
else if (componenttype1=="com.visteon.hwps.enum.comptype.literal.l9")
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l16");
}
//Network Interfaces
else if (componenttype1=="com.visteon.hwps.enum.comptype.literal.l10")
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l18");
componentname.push("com.visteon.hwps.enum.componentname.literal.l20");
}
//Display Interface
else if (componenttype1=="com.visteon.hwps.enum.comptype.literal.l11")
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l22");
}
//Camera Input
else if (componenttype1=="com.visteon.hwps.enum.comptype.literal.l12")
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l24");
}
//Tuner
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l13')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l26");
}
//BTWifi
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l14')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l28");
}
//PCB
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l15')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l30");
}
//Others
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l18')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l85");
}
else
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
}
}
//SmartCore QC6150 (W601)
else if (platformname1=='com.visteon.hwps.enum.platformname.literal.l8')
{
//SOC-GIP
if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l4')
(
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l32");
)
//VIP
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l7')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l34");
}
//Memory
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l6')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l36");
componentname.push("com.visteon.hwps.enum.componentname.literal.l38");
}
//Power Strategy
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l8')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l40");
}
//Display Sizes
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l9')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l42");
}
//Network Interfaces
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l10')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l44");
componentname.push("com.visteon.hwps.enum.componentname.literal.l46");
}
//Display Interface
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l11')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l48");
}
//Camera Input
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l12')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l50");
componentname.push("com.visteon.hwps.enum.componentname.literal.l52");
}
//Tuner
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l13')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l54");
}
//BTWifi
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l14')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l56");
}
//PCB
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l15')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l58");
componentname.push("com.visteon.hwps.enum.componentname.literal.l60");
}
//Others
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l18')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l85");
}
else
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
}
}
//Einstein 3.5
else if (platformname1=='com.visteon.hwps.enum.platformname.literal.l4')
{
//SOC-GIP
if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l4')
(
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l62");
)
//VIP
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l7')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
}
//Memory
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l6')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l64");
componentname.push("com.visteon.hwps.enum.componentname.literal.l67");
componentname.push("com.visteon.hwps.enum.componentname.literal.l69");
}
//Power Strategy
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l8')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l71");
}
//Display Sizes
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l9')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l16");
}
//Network Interfaces
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l10')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l75");
componentname.push("com.visteon.hwps.enum.componentname.literal.l77");
componentname.push("com.visteon.hwps.enum.componentname.literal.l79");
componentname.push("com.visteon.hwps.enum.componentname.literal.l81");
componentname.push("com.visteon.hwps.enum.componentname.literal.l81");
}
//Display Interface
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l11')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l83");
}
//Camera Input
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l12')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
}
//Tuner
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l13')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
}
//BTWifi
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l14')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
}
//PCB
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l15')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l30");
}
//Others
else if (componenttype1=='com.visteon.hwps.enum.comptype.literal.l18')
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
componentname.push("com.visteon.hwps.enum.componentname.literal.l85");
}
else
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
}
}
else
{
componentname.push("com.visteon.hwps.enum.componentname.literal.l2");
}
return componentname;
}
});
})();
But the script is not working and all the values in the enum are displayed in the field.
Is there any issue in the script?
|
3 answers
some quick things to check... try using === (triple equals) for comparison vs == (double equals) used above., triple equals is more accurate comparison...
secondly., in your comparison, you are using single quotes at places and double quotes at some other places... I would suggest values to be enclosed in double quotes while comparing...
and., you may want to add console.log statements to see what is the getValue returning., so as to be sure what is being returned as the literal value.,
lastly., ensure the attribute associated with the component Name1 attribute has the script set correctly and also has the dependencies on both the platform and component type..
|
Ralph Schoon (63.6k●3●36●46)
| answered Jul 10 '20, 5:23 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Unfortunately there is a lack of information about the type of the three(?) attributes involved. They could be of type enumeration or enumerationList. " all the values in the enum are displayed in the field" hint the latter.
Given that consider the following:
|
Thanks Dinesh and Ralph for your comments.
|
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.