I have also tried this code;
G_ERROR = "";
G_PLANT =
DD_PLANT.getSelectedValue();
var w_bookmark_id =
DD_BOOKMARK.getSelectedValue();
G_KPI_COUNT = 0;
//This piece of code is for the KPI Selection
G_KPI_STRING =
DS_OPDASH_KPISEL.getFilterExt("ZMOPDAKPI");
if(G_KPI_STRING =="+1(Text
Node)")
{G_KPI_STRING = "1/1;
1/2; 1/3; 1/4; 1/5; 1/6; 1/7; 1/8; 1/9";
}elseif(G_KPI_STRING =="+2(Text
Node)")
{G_KPI_STRING = "2/1";
}elseif(G_KPI_STRING =="+3(Text
Node)")
{G_KPI_STRING = "3/1;
3/2; 3/3; 3/4";
}elseif(G_KPI_STRING =="+3(Text
Node); +2(Text Node)"||G_KPI_STRING =="+2(Text Node); +3(Text
Node)")
{G_KPI_STRING = "3/1;
3/2; 3/3; 3/4; 2/1";
}elseif(G_KPI_STRING ==""||G_KPI_STRING
=="")
{G_ERROR = "X";
G_MESSAGE = "Please select up to 9
KPIs – Please check the selection";
}elseif(G_KPI_STRING =="+1(Text
Node); +2(Text Node)"||G_KPI_STRING =="+1(Text Node); +3(Text
Node)")
{G_ERROR = "X";
G_MESSAGE = "Maximum 9 KPIs can be
selected – Please check the selection";
}elseif(G_KPI_STRING =="+2(Text
Node); +1(Text Node)"||G_KPI_STRING =="+3(Text Node); +1(Text
Node)")
{G_ERROR = "X";
G_MESSAGE = "Maximum 9 KPIs can be
selected – Please check the selection";
}elseif(G_KPI_STRING =="+1(Text
Node); +2(Text Node); +3(Text Node)"||G_KPI_STRING =="+3(Text
Node); +2(Text Node); +1(Text Node)")
{G_ERROR = "X";
G_MESSAGE = "Maximum 9 KPIs can be
selected – Please check the selection";
}elseif(G_KPI_STRING =="+2(Text
Node); +3(Text Node); +1(Text Node)"||G_KPI_STRING =="+1(Text
Node); +3(Text Node); +2(Text Node)")
{G_ERROR = "X";
G_MESSAGE = "Maximum 9 KPIs can be
selected – Please check the selection";
}elseif(G_KPI_STRING =="+2(Text
Node); +1(Text Node); +3(Text Node)"||G_KPI_STRING =="+3(Text
Node); +1(Text Node); +2(Text Node)")
{G_ERROR = "X";
G_MESSAGE = "Maximum 9 KPIs can be
selected – Please check the selection";
}
//This piece of code generates the KPI count
used to determine the GRID lay out
var Array_KPI =
G_KPI_STRING.split(';');
Array_KPI.forEach(function(element, index)
{
G_KPI_COUNT
= G_KPI_COUNT + 1;
});
//Generates an alert telling us
the KPI Count
APPLICATION.alert("1st KPI
Count " + G_KPI_COUNT);
if (G_ERROR == "X") {
TXT_WARN.setText(G_MESSAGE);
POP_CHECK.show();
POP_VAR_SCREEN.show();
} else {
POP_VAR_SCREEN.hide();
if (w_bookmark_id != "1") {
G_BOOKMARK_SELECTED = true;
Bookmark.FragmentBookmark.loadBookmark(w_bookmark_id);
G_PLANT = TEXT_PLANT.getText();
DD_PLANT.setSelectedValue(G_PLANT);
}
//I entered
this code to turn off the charts 2 – 4 when KPI count was = 1
if (G_KPI_COUNT ==1) {
CHART_CELL_1.setVisible(true);
CHART_CELL_2.setVisible(false);
CHART_CELL_3.setVisible(false);
CHART_CELL_4.setVisible(false);
}
//This code determines the Grid
layout 2x2 or 3x3
if (G_KPI_COUNT
<= 4) {
GRID_KPI_9.setVisible(false);
GRID_KPI_4.setVisible(true);
DD_KPI_GRP_4_1.setItems(DS_OPDASH_KPI.getMemberList("ZMODKPIG",
MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT, 100));
DD_KPI_GRP_4_2.setItems(DS_OPDASH_KPI.getMemberList("ZMODKPIG",
MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT, 100));
DD_KPI_GRP_4_3.setItems(DS_OPDASH_KPI.getMemberList("ZMODKPIG",
MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT, 100));
DD_KPI_GRP_4_4.setItems(DS_OPDASH_KPI.getMemberList("ZMODKPIG",
MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT, 100));
} else {
GRID_KPI_9.setVisible(true);
GRID_KPI_4.setVisible(false);
DD_KPI_GRP_1.setItems(DS_OPDASH_KPI.getMemberList("ZMODKPIG",
MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT, 100));
DD_KPI_GRP_2.setItems(DS_OPDASH_KPI.getMemberList("ZMODKPIG",
MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT, 100));
DD_KPI_GRP_3.setItems(DS_OPDASH_KPI.getMemberList("ZMODKPIG",
MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT, 100));
DD_KPI_GRP_4.setItems(DS_OPDASH_KPI.getMemberList("ZMODKPIG",
MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT, 100));
DD_KPI_GRP_5.setItems(DS_OPDASH_KPI.getMemberList("ZMODKPIG",
MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT, 100));
DD_KPI_GRP_6.setItems(DS_OPDASH_KPI.getMemberList("ZMODKPIG",
MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT, 100));
DD_KPI_GRP_7.setItems(DS_OPDASH_KPI.getMemberList("ZMODKPIG",
MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT, 100));
DD_KPI_GRP_8.setItems(DS_OPDASH_KPI.getMemberList("ZMODKPIG",
MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT, 100));
DD_KPI_GRP_9.setItems(DS_OPDASH_KPI.getMemberList("ZMODKPIG",
MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT, 100));
}
HEADER_PLANT.setVisible(true);
HEADER_PLANT.setText(DD_PLANT.getSelectedText());
DD_PLANT_R.setSelectedValue(G_PLANT);
//Global Script Function Call
GLOBAL_SCRIPTS_1.RefreshDashboard();
DS_OPDASH_KPISEL.clearAllFilters();
}