Open hyperlink from each cell in table:
//get selection
var selections = Table_1.getSelections()[0];
console.log(selections);
console.log(selections["Name"]);
console.log(selections["Dashboard_Link"]);
//if contains link then open
if (selections["Dashboard_Link"].startsWith("http"))
{
NavigationUtils.openUrl(selections["Dashboard_Link"]);
}
Update comment table or widget:
// ****************** Get variables from main table **************************
Application.showBusyIndicator("Loading data...");
//get Fiscal Year from prompt
var p1=Table_Order.getDataSource().getVariableValues("V_FPER")[0];
// console.log(p1);
switch (p1.type) {
case VariableValueType.Single:
var singleValue = cast(Type.SingleVariableValue, p1);
Text_6.applyText(singleValue.value);
var cy=Text_6.getPlainText();
var yy=(cy.substring(0,4));
var mm=(cy.substring(5,7));
break;
case VariableValueType.Multiple:
var multiValue = cast(Type.MultipleVariableValue, p1);
console.log(multiValue.values); // can access the 'values' property now
break;
case VariableValueType.Range:
var rangeValue = cast(Type.RangeVariableValue, p1);
console.log("from");
console.log(rangeValue.from); // can access the 'from' property now
console.log("to");
console.log(rangeValue.to); // can access the 'to' property now
break;
default:
break;
}
console.log("month: " + mm);
console.log("year: " + yy);
//remove 0 from month
if(mm==="01"){
mm="1";
}else if(mm==="02"){
mm="2";
}else if(mm==="03"){
mm="3";
}else if(mm==="04"){
mm="4";
}else if(mm==="05"){
mm="5";
}else if(mm==="06"){
mm="6";
}else if(mm==="07"){
mm="7";
}else if(mm==="08"){
mm="8";
}else if(mm==="09"){
mm="9";
}else if(mm==="10"){
mm="10";
}else if(mm==="11"){
mm="11";
}else if(mm==="12"){
mm="12";
}
//prefix 0 in quarter
if(mm==="1" || mm==="2" || mm==="3"){
var qtr="01"; // quarter
var mnth2="3"; //last month of quarter
}else if(mm==="4" || mm==="5" || mm==="6"){
qtr="02"; // quarter
mnth2="6"; //last month of quarter
}else if(mm==="7" || mm==="8" || mm==="9"){
qtr="03"; // quarter
mnth2="9"; //last month of quarter
}else if(mm==="10" || mm==="11" || mm==="12"){
qtr="04"; // quarter
mnth2="12"; //last month of quarter
}
console.log("qtr month: " + mnth2);
// ******************** update comment table ***************************
Table_29.getDataSource().setDimensionFilter("Quarter","202502");
Table_29.getDataSource().setDimensionFilter("Period","6");
// ******************** update comment widget**************************
CommentWidget_1.getCommentingDataSource().setDimensionFilter("Quarter",yy+qtr);
CommentWidget_1.getCommentingDataSource().setDimensionFilter("Period",mnth2);
Application.hideBusyIndicator();
Filter main table based on commenting model page filter:
function onSelect() : void
//on Input Control select
var BA = InputControl_3.getInputControlDataSource().getActiveSelectedMembers()[0];
console.log(BA.displayId);
var chk = InputControl_3.getInputControlDataSource().isAllMembersSelected();
if (chk===false)
{
//apply BA filter
Table_4.getDataSource().setVariableValue("ABU_00",BA.displayId);
console.log(chk);
}
if (chk===true)
{
// clear BA filter
Table_4.getDataSource().setVariableValue("ABU_00",[]);
console.log(chk);
}
Get all dimension info:
//on page initialize
var xyz=Table_3.getDataSource().getDimensions();
console.log(xyz);
Filter table & comments based on page Quarter filter:
//Month
var getMonth=InputControl_2.getInputControlDataSource().getActiveSelectedMembers();
console.log("Month:");
console.log(getMonth[0].id);
console.log(getMonth[0].description);
//Year
var getYear=InputControl_1.getInputControlDataSource().getActiveSelectedMembers();
console.log("Year:");
console.log(getYear[0].id);
console.log(getYear[0].description);
var yy=(getYear[0].id.substring(0,4));
console.log("yy:");
console.log(yy);
//refresh table
if(getMonth[0].id === "10"){
Table_1.getDataSource().setVariableValue("V_FPER", yy+"0" + getMonth[0].id);
console.log("yy:"+"single zero");
}
else if(getMonth[0].id === "11"){
Table_1.getDataSource().setVariableValue("V_FPER", yy+"0" + getMonth[0].id);
console.log("yy:"+"single zero");
}
else if(getMonth[0].id === "12"){
Table_1.getDataSource().setVariableValue("V_FPER", yy+"0" + getMonth[0].id);
console.log("yy:"+"single zero");
}
else
{
Table_1.getDataSource().setVariableValue("V_FPER", yy+"00" + getMonth[0].id);
console.log("yy:"+"double zero");
}
Get model id:
//get model id
var tt=Application.getInfo();
console.log(tt);
// get fiscal year
var p1=Table_WorkingCapital.getDataSource().getVariableValues("V_FPER")[0];
console.log(p1);
var xx=Table_30.getDataSource().getDimensions();
console.log(xx);
// set story filter & refresh table
Table_WorkingCapital.getDataSource().setVariableValue("V_FPER",yy+"00"+mnth2);
//Application.getFileDataSource("B9006B832A7049795432AB51DEFB002D").setVariableValue("V_FPER",p1);
Table_WorkingCapital.getDataSource().refreshData();
Filter Dimensions in table:
var v_memberInfos = ArrayUtils.create(Type.MemberInfo);
v_memberInfos.push({id:"US",description:""});
v_memberInfos.push({id:"DE",description:""});
Table_1.getDataSource().setDimensionFilter("ZCNTRY",v_memberInfos);
Filter Measures in table:
//Filter specific measure in table
var v_memberInfos = ArrayUtils.create(Type.MemberInfo);
v_memberInfos.push({id:"6MU9WYQ1ZB8C1B5OA6R0CZPPW",description:"2408A"});
Table_57.getDataSource().setDimensionFilter("@MeasureDimension",v_memberInfos);
//remove measure filter from table
Table.removeDimension(Alias.MeasureDimension); Table.getDataSource().removeDimensionFilter(Alias.MeasureDimension);
//add measure filter from table
Table.addDimensionToColumns(Alias.MeasureDimension); Table.getDataSource().setDimensionFilter(Alias.MeasureDimension,"Id of the measure");
//------------------------------------------------------------------------
var measures = Table_57.getDataSource().getMeasures();
var measure = measures[0];
console.log(measure.description);
console.log(measure.dimensionId);
console.log(measure.id);
console.log(measure.modelId);
//------------------------------------------------------------------------
// practical example:
var array = Table_57.getDataSource().getResultSet();
console.log(array);
console.log(array[0]);
console.log(array[0][Alias.MeasureDimension].id);
var v_memberInfos = ArrayUtils.create(Type.MemberInfo);
//"2408A"
v_memberInfos.push({id:array[0][Alias.MeasureDimension].id,description:array[0][Alias.MeasureDimension].description});
//"2308A"
v_memberInfos.push({id:array[1][Alias.MeasureDimension].id,description:array[1][Alias.MeasureDimension].description});
//"YoY"
v_memberInfos.push({id:array[2][Alias.MeasureDimension].id,description:array[2][Alias.MeasureDimension].description});
//"2312A FY"
v_memberInfos.push({id:"6MU9WYQ1ZB8AB0S0LQWY98TOW",description:"2312A FY"});
Table_57.getDataSource().setDimensionFilter("@MeasureDimension",v_memberInfos);
Add or remove dimension from table:
var sel = DropDown_1.getSelectedKey();
Table_1.getDataSource().removeDimensionFilter("Dim1");
Table_1.getDataSource().setDimensionFilter("Dim1",sel);
Table_1.addDimensionToRows("CustomerUnit",2);
Table_1.removeDimension("CustomerAccountGroup");
Table_1.removeDimension("CustomerReportingGroup");
Table_1.removeDimension("Version");
Table_1.removeDimension("TopContributor");
Get specific measure from table:
//Using a table with 1 dimension & 1 measure this seems to work
var arr = Chart_1.getDataSource().getResultSet();
var value = ArrayUtils.create(Type.number);
for (var i=0;i<arr.length;i++)
{var string = arr[i][Alias.MeasureDimension].formattedValue;
var number = ConvertUtils.stringToNumber(string);
value.push(number);}
console.log(value);
Get specific dimension from table:
var str="";
var selections = Chart_1.getDataSource().getDataSelections();
console.log(selections);
for (var i=0; i<selections.length; i++){
str =str+selections[i].EmployeeUserName+";";
};
console.log(str);
Drill down table:
//Table_1 - onSelect:
Application.setAutomaticBusyIndicatorEnabled(true);
var NoDim=Table_1.getDimensionsOnRows().length;
console.log(NoDim);
SelectionArray_Table1 = Table_1.getSelections();
var CurrentCoCd = SelectionArray_Table1[0]["0COMP_CODE"];
var CurrentGL = SelectionArray_Table1[0]["0GL_ACCOUNT"];
var CurrentDocNo = SelectionArray_Table1[0]["LFIN_DOC"];
console.log(CurrentCoCd);
console.log(CurrentGL);
console.log(CurrentDocNo);
Table_1.getDataSource().setRefreshPaused(true);
if (NoDim===1){
Table_1.getDataSource().setDimensionFilter("0COMP_CODE",CurrentCoCd);
Table_1.addDimensionToRows("0GL_Account",2);
}
if (NoDim===2){
Table_1.getDataSource().setDimensionFilter("0GL_ACCOUNT",CurrentGL);
Table_1.addDimensionToRows("0DOC_DATE",3);
Table_1.addDimensionToRows("LFIN_DOC",4);
Table_1.addDimensionToRows("0ORG_DOC_NO",5);}
if (NoDim===5){
Table_1.getDataSource().setDimensionFilter("0GL_ACCOUNT",CurrentGL);
Table_1.addDimensionToRows("0FISCPER",3);
Table_1.addDimensionToRows("0DOC_CURRCY",7);
Table_1.addDimensionToRows("0LOC_CURRCY",8);
Table_1.addDimensionToRows("0ALLOC_NMBR",9);
Table_1.addDimensionToRows("CBKTXT",10);
Table_1.addDimensionToRows("0POSTXT",11);
Table_1.addDimensionToRows("0DCINDIC",12);
}
if (NoDim===12){
Table_1.getDataSource().setDimensionFilter("0GL_ACCOUNT",CurrentGL);
}
Table_1.getDataSource().setRefreshPaused(false);
Table_1.getDataSource().refreshData();
//Button_RemoveDimension2:
Application.setAutomaticBusyIndicatorEnabled(true);
var NoDim=Table_1.getDimensionsOnRows().length;
console.log(NoDim);
Table_1.getDataSource().setRefreshPaused(true);
if (NoDim===1){
}
if (NoDim===2){
Table_1.removeDimension("0GL_ACCOUNT");
Table_1.getDataSource().removeDimensionFilter("0COMP_CODE", CoCdArray);
}
if (NoDim===5){
Table_1.removeDimension("0DOC_DATE");
Table_1.removeDimension("LFIN_DOC");
Table_1.removeDimension("0ORG_DOC_NO");
Table_1.getDataSource().removeDimensionFilter("0GL_ACCOUNT");
}
if (NoDim===12){
Table_1.removeDimension("0FISCPER");
Table_1.removeDimension("0DOC_CURRCY");
Table_1.removeDimension("0ALLOC_NMBR");
Table_1.removeDimension("0POSTXT");
Table_1.removeDimension("0DCINDIC");
Table_1.removeDimension("0DOC_CURRCY");
Table_1.removeDimension("0LOC_CURRCY");
Table_1.removeDimension("CBKTXT");
}
Table_1.getDataSource().setRefreshPaused(false);
Table_1.getDataSource().refreshData();
//WelcomeChart3 - onSelect:
Application.setAutomaticBusyIndicatorEnabled(true);
Table_2.getDataSource().setDimensionFilter(Alias.MeasureDimension,["6MU9W....","6MU9W...."]);
Table_2.getDataSource().setDimensionFilter("0GL_ACCOUNT",GACaccounts1);
Table_2.addDimensionToRows("0GL_ACCOUNT");
GAC_Open_Items.setSelectedKeys('Tab_2');
0 टिप्पणियाँ
Please do not enter any spam link in the comment box.