/**************************************************************** ** Licensed Materials - Property of IBM ** ** BI and PM: qs ** ** (C) Copyright IBM Corp. 2001, 2015 ** ** US Government Users Restricted Rights - Use, duplication or ** disclosure restricted by GSA ADP Schedule Contract with IBM Corp. *****************************************************************/ // Copyright (C) 2008 Cognos ULC, an IBM Company. All Rights Reserved. // Cognos and the Cognos logo are trademarks of Cognos ULC (formerly Cognos Incorporated) in the United States and/or other countries. IBM and the IBM logo are trademarks of International Business Machines Corporation in the United States, or other countries, or both. Other company, product, or service names may be trademarks or service marks of others. function CConditionalStyle() { }; CConditionalStyle.prototype = new AFeatureObject(); CConditionalStyle.prototype.setup = function (aFeatureParams) { condStyles(); }; function condStyles() { cfgSet("LAST_DIALOG", "condStyles"); dlgReset(); dlgGlobalReset(); if (cfgSize("CalcFns") == 0 || cfgGet("currentMetadataFunctionOperations") != "all") { cfgSet("postFetchFunctionToRun", condStyles); fetchMetadataFunctionList(); return; } var oSelController = goApplicationManager.getSelectionController(); var aSelections = oSelController.getSelections(); if (aSelections.length <= 0) { dlgShowMessage("COND_STYLE_TITLE", "", "COND_STYLE_NO_SELECTION"); return; } if (aSelections.length > 1) { dlgShowMessage("COND_STYLE_TITLE", "", "COND_STYLE_TOO_MANY_SELECTIONS"); return; } var sColTag = ""; var oMQMgr = goApplicationManager.getMiniQueryManager(); var oColumn = oMQMgr.getColumnById(aSelections[0].getColumnName()); if (oColumn === MINI_QUERY_NO_COLUMN_FOUND) { sColTag = aSelections[0].getTag(); } else { sColTag = oColumn.getAttribute("tag"); if (!oMQMgr.isMeasure(oColumn)) { var oMeasure = null; var sColRefId = getColRefIdFromSelectionObject(aSelections[0]); oMeasure = oMQMgr.getColumnById(sColRefId); if (oMeasure !== MINI_QUERY_NO_COLUMN_FOUND) { sColTag = oMeasure.getAttribute("tag"); } } } var iColIndex = oMQMgr.getColumnIndexByAttribute("tag", sColTag); if (determineDataType(parseInt(oMQMgr.getDataType(iColIndex))) >= 7) { dlgShowMessage("COND_STYLE_TITLE", "", "COND_STYLE_INVALID_SELECTION"); return; } if (oMQMgr.isReportExpression(iColIndex)) { dlgShowMessage("COND_STYLE_TITLE", "", "COND_STYLE_REPORT_EXPRESSION"); return; } var oMQMgr = goApplicationManager.getMiniQueryManager(); var bHasNumericDetailAgg = oMQMgr.hasNumericDetailAggregate(oColumn); var bIsString = false; var iDataType = getDataType(oColumn); if (iDataType == 5 && bHasNumericDetailAgg) { iDataType = 0; } else if (iDataType == 5) { bIsString = true; } var mqObject = cfgGet("MiniQueryObj"); var c = mqObject.findChildWithAttribute('id', oMQMgr.getColumnId(iColIndex)); if (isLevel(c)) { dlgGlobalSetParm('xxDataType', 'level'); dlgGlobalSetParm("xxLevelNumber", c.getAttribute("levelNumber")); dlgSetParm("xxLevelNumber", c.getAttribute("levelNumber")); } else if (isHierarchy(c)) { dlgGlobalSetParm('xxDataType', 'hierarchy'); } else if (isMember(c)) { dlgGlobalSetParm('xxDataType', 'member'); } else if (bIsString) { dlgGlobalSetParm('xxDataType', 'string'); } if (checkCalcFunctionAgainstDB("ces_like") && checkCalcFunctionAgainstDB("ces_starts_with") && checkCalcFunctionAgainstDB("ces_contains") && checkCalcFunctionAgainstDB("MEMBER_SEARCH_STARTS_WITH") && checkCalcFunctionAgainstDB("MEMBER_SEARCH_ENDS_WITH") && checkCalcFunctionAgainstDB("MEMBER_SEARCH_CONTAINS")) { dlgGlobalSetParm("xxIsSearchAllowed", true); } else { dlgGlobalSetParm("xxIsSearchAllowed", false); } var oMQMgr = goApplicationManager.getMiniQueryManager(); if (oMQMgr != null) { dlgGlobalSetParm("xxExprLocale", oMQMgr.getExpressionLocale()); } dlgGlobalSetParm("xxExp", oMQMgr.getExpression(iColIndex)); dlgGlobalSetParm("xxId", oMQMgr.getColumnId(iColIndex)); dlgGlobalSetParm("xxName", oMQMgr.getColumnLabel(iColIndex)); dlgGlobalSetParm("xxType", iDataType); dlgGlobalSetParm("xxColType", oMQMgr.getDataType(iColIndex)); dlgSetParm("xxType", iDataType); dlgSetParm("m", "/" + qs_dir + "/condStyles.xts"); dlgSubmit(); };