123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 |
- /****************************************************************
- ** 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 CFilterComplex()
- {
- this.m_bFeatureRequiresQualityOfService = true;
- };
- CFilterComplex.prototype = new AFeatureObject();
- CFilterComplex.prototype.setup = function (aFeatureParams)
- {
- if (typeof aFeatureParams != "undefined" && aFeatureParams instanceof Array && aFeatureParams.length > 0)
- {
- complexFilter(aFeatureParams[0]);
- }
- else
- {
- complexFilter();
- }
- };
- function complexFilter(sFilterId)
- {
- if (!canUseQueryStudioAdvancedMode)
- {
- if (getCombinedFilter())
- {
- dlgShowMessage("FILTER_TITLE", "", "FILTER_CANNOT_CHANGE_COMPLEX");
- }
- else
- {
- goApplicationManager.getFeatureManager().launchFeature('FilterSimple');
- }
- return;
- }
-
-
- if (cfgGet("LAST_DIALOG") != "filterComplex" || ! goApplicationManager.getWindowManager().isDialogFrameOpen())
- {
- launchCombineDialog(sFilterId);
- }
- };
- function launchCombineDialog(sFilterId)
- {
- cfgSet("LAST_DIALOG", "filterComplex");
-
- var oCC = getCombinedFilter();
- if (!oCC)
- {
- oCC = convertToCombinedFilter();
- }
-
- var sTab = dlgGlobalGetParm("xxFCtab");
- if (!sTab)
- {
- if (oCC.getRawFilter().getSize() > 0)
- {
- sTab = "r";
- }
- else if (oCC.getSummaryFilter().getSize() > 0)
- {
- sTab = "s";
- }
- else
- {
-
- sTab = (oCC.getCurrentFilterGroup() == oCC.getSummaryFilter() ? 's': 'r');
- }
- }
- if (!isDetailFilterEnabled())
- {
-
- sTab = 's';
- }
- else if (sFilterId)
- {
-
- if (oCC.getRawFilter().getFilterById(sFilterId) !== null)
- {
- sTab = 'r';
- }
- else if (oCC.getSummaryFilter().getFilterById(sFilterId) !== null)
- {
- sTab = 's';
- }
- }
-
-
- oCC.setFilterView(sTab === "r" ? giFILTERVIEW_RAW : giFILTERVIEW_SUMMARY);
- dlgReset();
- dlgGlobalReset();
- setFilterMode(giFILTERCPLXMODE_PRE_WIZARD);
- if (isDetailFilterEnabled())
- {
- dlgGlobalSetParm("xxAllowDetail", true);
- }
- dlgGlobalSetParm("xxFCtab", sTab);
- dlgSetParm("m_tab", sTab);
- dlgSetParm("m", "/" + qs_dir + "/filterCombine.xts");
- dlgSubmit();
- };
- function convertToCombinedFilter()
- {
- var oMQMgr = goApplicationManager.getMiniQueryManager();
-
- var oCC = new CCombinedFilter();
- cfgSet("combinedFilters", oCC);
- var aFilterNodes = oMQMgr.getElementsByTagName("Filter");
- if (aFilterNodes !== MINI_QUERY_NO_COLUMN_FOUND)
- {
- for (var idxFilter = 0; idxFilter < aFilterNodes.length; idxFilter++)
- {
- var nFilter = aFilterNodes[idxFilter];
- var oFilter = new CFilter("", nFilter);
- var sColumnId = oFilter.getColumnId();
- if (sColumnId)
- {
- nFilter.setAttribute("columnId", sColumnId);
- }
- var oColumn = oMQMgr.getColumnById(sColumnId);
- if (oColumn !== MINI_QUERY_NO_COLUMN_FOUND)
- {
-
- var bIsMeasure = oMQMgr.isMeasure(oColumn);
- var sType = "measure";
-
-
- var iPromptType = parseInt(oMQMgr.getPromptType(oColumn));
- if ((oMQMgr.getPromptFilterItemRef(oColumn) != "none") && !bIsMeasure)
- {
- if (iPromptType == 7)
- {
- sType = "selectWithSearch";
- }
- else
- {
- sType = "picklist";
- }
- }
- else if ((iPromptType > 0) && !bIsMeasure)
- {
- switch (iPromptType)
- {
- case 1:
- sType = "editBox";
- break;
- case 2:
- sType = "selectDate";
- break;
- case 3:
- sType = "selectDateTime";
- break;
- case 4:
- sType = "selectInterval";
- break;
- case 5:
- sType = "selectTime";
- break;
- case 7:
- sType = "selectWithSearch";
- break;
- default:
- sType = "picklist";
- }
- }
- else
- {
- if (isString(oColumn))
- {
- sType = "picklist";
- }
- else
- {
- var colType = oMQMgr.getDataType(oColumn);
- switch (determineDataType(parseInt(colType, 10)))
- {
- case 0:
- sType = (bIsMeasure ? "measure" : "numeric");
- break;
- case 3:
- sType = "selectDateTime";
- break;
- case 1:
- sType = "selectDate";
- break;
- case 2:
- sType = "selectTime";
- break;
- case 4:
- sType = "selectInterval";
- break;
- }
- }
- }
- nFilter.setAttribute("type", sType);
- }
- else
- {
- nFilter.setAttribute("type", "model");
- }
-
-
- if (nFilter.getAttribute("summary"))
- {
- oCC.getSummaryFilter().addPredicate(nFilter.cloneNode(true));
- }
- else
- {
- oCC.getRawFilter().addPredicate(nFilter.cloneNode(true));
- }
- }
- }
- dlgGlobalSetParm("xxFCtab", (oCC.getSummaryFilter().getSize() > 0 ? 's': 'r'));
- return oCC;
- };
|