123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- 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();
- };
|