123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- /****************************************************************
- ** 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 CFilterFromTree()
- {
- this.m_bFeatureRequiresQualityOfService = true;
- };
- CFilterFromTree.prototype = new AFeatureObject();
- CFilterFromTree.prototype.getAddCommand = function(oNode, sMQColumnId, oSelectedLeaf)
- {
- var sCmd = "";
- var bIsHierarchy = (typeof oNode.isHierarchy != "undefined" && oNode.isHierarchy == true) ? true : false;
- if (bIsHierarchy && checkCalcFunctionAgainstDB(gsMETADATA_MEMBER_SEARCH_IN_HIERARCHY) === false && checkRestrictedCalcFunctionAgainstDB(gsMETADATA_MEMBER_SEARCH_IN_HIERARCHY) === false)
- {
- return sCmd;
- }
- var hun = (typeof oNode.hun != "undefined") ? oNode.hun : "none";
- var levelOrdinal = (typeof oNode.levelOrdinal != "undefined") ? oNode.levelOrdinal : "none";
- var metaType = getMetaType(oSelectedLeaf);
- var id = "XX" + addColumnId++;
- sCmd = generateAcCmd(-1, id, oNode.ref, sMQColumnId, oNode.datatype, oNode.usage, oNode.regularAggregate, oNode.semiAggregate, oNode.promptType, oNode.displayType, oNode.sortOnRef, oNode.promptCascadeOnRef, oNode.promptFilterItemRef,
- "none",
- bIsHierarchy, levelOrdinal, hun, metaType, oNode.currency, oNode.promptUseItemRef, oNode.promptDisplayItemRef);
- return sCmd;
- };
- CFilterFromTree.prototype.getUniqueColumnId = function (sId)
- {
- var sRetval = sId;
- var oMQMgr = goApplicationManager.getMiniQueryManager();
-
-
-
- var iIdx = 2;
- while( oMQMgr.getColumnById(sRetval) !== MINI_QUERY_NO_COLUMN_FOUND)
- {
- sRetval = sId + (iIdx++);
- }
- return sRetval;
- };
- function hasNumericDetailAgg(oNode)
- {
- var iDataType = determineDataType(parseInt(oNode.datatype,10));
- var bHasNumericDetailAgg = false;
- if(iDataType ==DATA_TYPE_NUMERIC || oNode.oldUsage)
- bHasNumericDetailAgg = true;
- else if(iDataType == DATA_TYPE_STRING && oNode.usage === USAGE_VALUE_MEASURE)
- {
- var agg =oNode.detailAgg;
- if(!agg || agg == "none" || agg == "automatic" || agg == "calculated")
- {
- agg = oNode.regularAggregate;
- }
- if(agg == "maximum" || agg == "minimum")
- bHasNumericDetailAgg = false;
- else
- bHasNumericDetailAgg = true;
- }
- return bHasNumericDetailAgg;
- };
- function getFiltertypeFromUserPreference()
- {
-
-
-
-
-
- var oUserPreference = goApplicationManager.getUserPreferenceManager().getPreference("defaultFilterDialogType");
- var sFilterPreference = "";
- var sXTS = "";
- if (typeof oUserPreference === "object")
- {
- sFilterPreference = oUserPreference.getValue();
- }
-
- if (sFilterPreference === "typein" && ! cf.checkCalcFunctionAgainstDB("FLEXIBLE_FILTERS"))
- {
- sFilterPreference = "default";
- }
-
-
- switch (sFilterPreference)
- {
- case "search":
- sXTS = "/" + qs_dir + "/filterSearch.xts";
- break;
- case "typein":
- sXTS = "/" + qs_dir + "/filterTypeInExactlyMatches.xts";
- break;
- case "default":
- case "picklist":
- default:
- sXTS = "/" + qs_dir + "/filterPickList.xts";
- break;
- }
- return sXTS;
- };
- CFilterFromTree.prototype.setup = function (aFeatureParams)
- {
-
- if (window && window.getSelection && window.getSelection().removeAllRanges)
- {
- window.getSelection().removeAllRanges();
- }
- var aNodes = metadataTree.getSelectionOrder();
- if (aNodes && aNodes.length > 0)
- {
- var oSelectedLeaf = aNodes[0];
- var oNode = allMetadataObjects[oSelectedLeaf.getValue()];
- if (oSelectedLeaf.hierarchyPath && oSelectedLeaf.hierarchyName)
- {
- oNode = new mdQueryItem(oSelectedLeaf.hierarchyName, gsMETADATA_EMPTY, oSelectedLeaf.hierarchyPath, 60, 7, 0, 0, 0, 0, gsMETADATA_EMPTY, gsMETADATA_EMPTY, gsMETADATA_EMPTY, gsMETADATA_EMPTY, gsMETADATA_EMPTY, gsMETADATA_EMPTY, gsMETADATA_EMPTY);
- oNode.isHierarchy = true;
- }
-
- oNode = concatAssociativeArrays(oNode, oSelectedLeaf);
- var sNodeType = getNodeObjectType(oNode);
- if ( !(sNodeType == 'FILTER' || sNodeType == 'CALCULATION' || sNodeType == 'FOLDER') )
- {
-
- dlgReset();
- dlgGlobalReset();
-
- var cf = getConfigFrame();
- cf.dlgGlobalSetParm("xxNewFilter", true);
- var iFilterDialogMode = cf.getFilterDialogMode("");
- if (iFilterDialogMode != null)
- {
- cf.setFilterMode(iFilterDialogMode);
- }
-
- dlgGlobalSetParm("metadataNode", oNode);
- var sXTS = "";
- if (oNode.promptType !== "0")
- {
- sXTS = getFilterXTSPathFromPromptType(oNode.promptType, oNode.metadataType == "attribute");
- }
- if (!sXTS)
- {
- var iDataType = determineDataType(parseInt(oNode.datatype,10));
-
- bHasNumericDetailAgg = hasNumericDetailAgg(oNode);
- if(iDataType === 5 && !bHasNumericDetailAgg)
- sXTS = getFiltertypeFromUserPreference();
- else
- sXTS = getFilterXTSPathFromDataType(iDataType);
- }
- oNode.bFromMetadata = true;
- setFilterDialogValues(
- oNode,
- sXTS,
- "",
- oNode.ref,
- oNode.name,
- oNode.promptUseItemRef );
-
-
-
- setXTSPromptId(oNode.name);
- var oData = this.getMetadataDATA(oNode, oSelectedLeaf);
- if (oData["columnId"])
- {
- dlgGlobalSetParm("xxFCid", oData["columnId"]);
- cfgSet("_META_" + oData["columnId"], oData);
- }
- else if (oData["MQColumn"])
- {
-
- dlgGlobalSetParm("xxFCid", oData["MQColumn"].getAttribute("id"));
- }
- dlgGlobalSetParm("xxFilterFromMetadata", true);
- dlgGlobalSetParm("xxShowTypeInDropDown", cf.checkCalcFunctionAgainstDB("FLEXIBLE_FILTERS"));
- dlgSetParm("xxShowTypeInDropDown", dlgGlobalGetParm("xxShowTypeInDropDown"));
- dlgSubmit();
- }
- }
-
- dlgGlobalSetParm("xxShowTypeInDropDown", cf.checkCalcFunctionAgainstDB("FLEXIBLE_FILTERS"));
- cfgRemove("contextMenuType");
- cfgRemove("contextMenuId");
- };
- CFilterFromTree.prototype.getMetadataDATA = function(oNode, oSelectedLeaf)
- {
- var oDATA = {};
- var oMQMgr = goApplicationManager.getMiniQueryManager();
- var oColumn = oMQMgr.getColFromExpression(oNode.ref);
- if (oColumn === MINI_QUERY_NO_COLUMN_FOUND)
- {
- oDATA["columnId"] = this.getUniqueColumnId(oNode.name);
- oDATA["originalColumnId"] = oNode.name;
- oDATA["xxPromptId"] = dlgGlobalGetParm("xxPromptID");
- oDATA["addCmd"] = this.getAddCommand(oNode, oDATA.originalColumnId, oSelectedLeaf);
- }
- else
- {
- oDATA["MQColumn"] = oColumn;
- }
- return oDATA;
- };
|