dimtreecommands.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // Licensed Materials - Property of IBM
  2. //
  3. // IBM Cognos Products: pps
  4. //
  5. // (C) Copyright IBM Corp. 2005, 2017
  6. //
  7. // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8. function getLastItemStr(str) {
  9. var codeSep = topparent.getGlobal("codeSeparator");
  10. if (str.indexOf(codeSep)) {
  11. var subs = str.split(codeSep);
  12. return subs[subs.length - 1];
  13. } else {
  14. return str;
  15. }
  16. }
  17. function replaceRows(obj) {
  18. var com = doPreUnHideCommand(obj);
  19. com += 'ER' + ':' + 'R-1' + '\t' + 'D' + obj.getAttribute("dimIdx") + '\t' + getLastItemStr(obj.getAttribute("ppdsId")) + "," + obj.getAttribute("dimIdx") + ';' + getLastItemStr(obj.getAttribute("code"));
  20. topparent.getXtabFrame().doit(com);
  21. }
  22. function replaceCols(obj) {
  23. var com = doPreUnHideCommand(obj);
  24. com += 'ER' + ':' + 'C-1' + '\t' + 'D' + obj.getAttribute("dimIdx") + '\t' + getLastItemStr(obj.getAttribute("ppdsId")) + "," + obj.getAttribute("dimIdx") + ';' + getLastItemStr(obj.getAttribute("code"));
  25. topparent.getXtabFrame().doit(com);
  26. }
  27. function nestRowsInner(obj) {
  28. var xtabFrame = topparent.getXtabFrame();
  29. var targetDim = xtabFrame.rowDimIdx[parseInt(xtabFrame.numRowLevels) - 1];
  30. var com = doPreUnHideCommand(obj);
  31. com += 'EN:R' + (parseInt(xtabFrame.numRowLevels) - 1) + '\tD' + obj.getAttribute("dimIdx") + '\t' + obj.getAttribute("level");
  32. if (obj.getAttribute("dimIdx") != targetDim) //need to isolate the correct nesting group, as we are nesting from another dimension
  33. com += '\t\t' + 'DG:R' + xtabFrame.numRowLevels + '\t' + getLastItemStr(obj.getAttribute("ppdsId")) + ',' + obj.getAttribute("dimIdx") + ';' + getLastItemStr(obj.getAttribute("code"));
  34. xtabFrame.doit(com);
  35. }
  36. function nestColsInner(obj) {
  37. var xtabFrame = topparent.getXtabFrame();
  38. var targetDim = xtabFrame.colDimIdx[parseInt(xtabFrame.numColLevels) - 1];
  39. var com = doPreUnHideCommand(obj);
  40. com += 'EN:C' + (xtabFrame.numColLevels - 1) + '\tD' + obj.getAttribute("dimIdx") + '\t' + obj.getAttribute("level");
  41. if (obj.getAttribute("dimIdx") != targetDim ) //need to isolate the correct nesting group, as we are nesting from another dimension
  42. com += '\t\t' + 'DG:C' + xtabFrame.numColLevels + '\t' + getLastItemStr(obj.getAttribute("ppdsId")) + ',' + obj.getAttribute("dimIdx") + ';' + getLastItemStr(obj.getAttribute("code"));
  43. xtabFrame.doit(com);
  44. }
  45. function filter(obj) {
  46. var com = 'DC' + ':' + getLastItemStr(obj.getAttribute("ppdsId")) + "," + obj.getAttribute("dimIdx") + ';' + getLastItemStr(obj.getAttribute("code"));
  47. topparent.getXtabFrame().doit(com);
  48. }
  49. function nestRowsOuter(obj) {
  50. var xtabFrame = topparent.getXtabFrame();
  51. var targetDim = xtabFrame.rowDimIdx[parseInt(xtabFrame.numRowLevels) - 1];
  52. var com = doPreUnHideCommand(obj);
  53. com += 'EN:R-1\tD' + obj.getAttribute("dimIdx") + '\t' + obj.getAttribute("level");
  54. if (obj.getAttribute("dimIdx") != targetDim) //need to isolate the correct nesting group, as we are nesting from another dimension
  55. com += '\t\t' + 'DG:R' + xtabFrame.numRowLevels + '\t' + getLastItemStr(obj.getAttribute("ppdsId")) + ',' + obj.getAttribute("dimIdx") + ';' + getLastItemStr(obj.getAttribute("code"));
  56. xtabFrame.doit(com);
  57. }
  58. function nestColsOuter(obj) {
  59. var xtabFrame = topparent.getXtabFrame();
  60. var targetDim = xtabFrame.colDimIdx[parseInt(xtabFrame.numRowLevels) - 1];
  61. var com = doPreUnHideCommand(obj);
  62. com += 'EN:C-1\tD' + obj.getAttribute("dimIdx") + '\t' + obj.getAttribute("level");
  63. if (obj.getAttribute("dimIdx") != targetDim ) //need to isolate the correct nesting group, as we are nesting from another dimension
  64. com += '\t\t' + 'DG:C' + xtabFrame.numColLevels + '\t' + getLastItemStr(obj.getAttribute("ppdsId")) + ',' + obj.getAttribute("dimIdx") + ';' + getLastItemStr(obj.getAttribute("code"));
  65. xtabFrame.doit(com);
  66. }
  67. function replaceMeasure(obj) {
  68. var com = "DC:" + getLastItemStr(obj.getAttribute("ppdsId")) + ',' + obj.getAttribute("dimIdx") + ',' + getLastItemStr(obj.getAttribute("code"));
  69. topparent.getXtabFrame().doit(com);
  70. }
  71. function doPreUnHideCommand(obj) {
  72. var cmd = "";
  73. if (topparent.getGlobal("gDimensionInfo")[obj.getAttribute("dimIdx")].isMeasureDimension) {
  74. cmd = "MS:0\t" + getLastItemStr(obj.getAttribute("ppdsId")) + ',' + obj.getAttribute("dimIdx") + ',' + getLastItemStr(obj.getAttribute("code")) + "\t\t";
  75. }
  76. return cmd;
  77. }