| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 | <!--******************************************************************* Licensed Materials - Property of IBM**** IBM Cognos Products: drill**** (C) Copyright IBM Corp. 2001, 2010**** US Government Users Restricted Rights - Use, duplication or ** disclosure restricted by GSA ADP Schedule Contract with ** IBM Corp.*****************************************************************--><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy for Windows (vers 1st July 2003), see www.w3.org"><title>Selection Context Library Test Page</title><script language="javascript" src="http://localhost/cognos8/cognoslaunch.js" type="text/javascript"></script><script language="javascript" src="http://localhost/cognos8/drill/utility.js" type="text/javascript"></script><script language="javascript" src="http://localhost/cognos8/drill/CSelectionContextBuilder.js" type="text/javascript"></script></head><body><script language="javascript" type="text/javascript">                <!--                        //Example 1: Build a basic selection context includes selection of a single value from a single column.                        function BuildBasicSelection()                        {                                                                var oSelectionContext   = new CSelectionContext(document.getElementById("fModelPath").value);   //The output selection context                                //Select a measure (add more by adding to the childSelections array)...??could also be built from child to parent??                                var oProdLine = oSelectionContext.addSelectedCell(      /*dataItemName*/                "Product line",                                                                                                                                         /*metadataModelItem*/   "[Great_Outdoors].[Products].[Products].[Product line]",                                                                                                                                        /*useValue*/                    "[Great_Outdoors].[Products].[Products].[Product line]->:[PC].[@MEMBER].[2103]",                                                                                                                                        /*useValueType*/                "memberUniqueName",                                                                                                                                        /*displayValue*/                "Personal Accessories");                                //The final selection context is made up of the header, the metadata table, the cells and the strings.                                document.getElementById("fSC").value = oSelectionContext.toString();                        }                        //Example 2: Build the selection context for a nested selection including a single value from a single cell                        //                       and a "parent" as would beseen in a higher level of a nested crosstab.                        function BuildNestedSelection()                        {                                                                var oSelectionContext   = new CSelectionContext(document.getElementById("fModelPath").value);   //The output selection context                                //Select a column....(order method type = "Mail")                                var oOrderMethod = oSelectionContext.addSelectedCell(   /*dataItemName*/                "Order method type",                                                                                                                                         /*metadataModelItem*/   "[Great_Outdoors].[Order method].[Order method].[Order method type]",                                                                                                                                        /*useValue*/                    "[Great_Outdoors].[Order method].[Order method].[Order method type]->:[PC].[@MEMBER].[603]",                                                                                                                                        /*useValueType*/                "memberUniqueName",                                                                                                                                        /*displayValue*/                "Mail");                                //Select a column....(product line = "Personal Accessories")                                var oProdLine = oOrderMethod.addDefiningCell(                   /*dataItemName*/                "Product line",                                                                                                                                         /*metadataModelItem*/   "[Great_Outdoors].[Products].[Products].[Product line]",                                                                                                                                        /*useValue*/                    "[Great_Outdoors].[Products].[Products].[Product line]->:[PC].[@MEMBER].[2103]",                                                                                                                                        /*useValueType*/                "memberUniqueName",                                                                                                                                        /*displayValue*/                "Personal Accessories");                                				//Give the defining cell an axis ordinal				oProdLine.addProperty('ordinal', '2');                                //The final selection context is made up of the header, the metadata table, the cells and the strings.                                document.getElementById("fSC").value = oSelectionContext.toString();                        }                        //Example 3: Build the selection context for a measure which is made up of the measure and two defining cells (one for                        //                       row and one for column AND a nested selection in the rows (product line/product type)).                        function BuildNestedMeasure()                        {                                                        var oSelectionContext   = new CSelectionContext(document.getElementById("fModelPath").value);   //The output selection context                                //Select a measure (add more by adding to the childSelections array)...??could also be built from child to parent??                                var oMeasure = oSelectionContext.addSelectedCell(       /*dataItemName*/                "Quantity",                                                                                                                                         /*metadataModelItem*/   "[Great_Outdoors].[Measures].[Quantity]",                                                                                                                                        /*useValue*/                    "500",                                                                                                                                        /*useValueType*/                "Decimal",                                                                                                                                        /*displayValue*/				"$500.00",                                                                                                                                        /*usage*/						"measure");                                //Select a column....(product type = "Tents")                                var oProdType = oMeasure.addDefiningCell(       /*dataItemName*/                "Product type",                                                                                                                                         /*metadataModelItem*/   "[Great_Outdoors].[Products].[Products].[Product type]",                                                                                                                                        /*useValue*/                    "[Great_Outdoors].[Products].[Products].[Product type]->:[PC].[@MEMBER].[102]",                                                                                                                                        /*useValueType*/                "memberUniqueName",                                                                                                                                        /*displayValue*/                "Personal Accessories",                                                                                                                                        /*usage*/						"identifier");                                //Select a column....(product line = "Personal Accessories")                                var oProdLine = oProdType.addDefiningCell(                      /*dataItemName*/                "Product line",                                                                                                                                         /*metadataModelItem*/   "[Great_Outdoors].[Products].[Products].[Product line]",                                                                                                                                        /*useValue*/                    "[Great_Outdoors].[Products].[Products].[Product line]->:[PC].[@MEMBER].[2103]",                                                                                                                                        /*useValueType*/                "memberUniqueName",                                                                                                                                        /*displayValue*/                "Personal Accessories",                                                                                                                                        /*usage*/						"identifier");                                //Note: declaring a variable is only required if nesting above a cell.                                oMeasure.addDefiningCell(       /*dataItemName*/                "Year",                                                                                         /*metadataModelItem*/   "[Great_Outdoors].[Time].[Time].[Year]",                                                                                        /*useValue*/                    "[Great_Outdoors].[Time].[Time].[Year]->:[PC].[@MEMBER].[20050101-20051231]",                                                                                        /*useValueType*/                "memberUniqueName",                                                                                        /*displayValue*/                "2005",                                                                                        /*usage*/						"identifier");                                //The final selection context is made up of the header, the metadata table, the cells and the strings.                                document.getElementById("fSC").value = oSelectionContext.toString();                        }                        //Example 4: Build a selection context where multiple values for the same item are selected (at the root)                        function BuildMultiSelectSameItemAtRoot()                        {                                //Create the Selection interface objects....IMPORTANT: Need better names for these top level interfaces!                                var oSelectionContext   = new CSelectionContext(document.getElementById("fModelPath").value);   //The output selection context                                //Select a column....(product type = "Tents")                                var oProdType = oSelectionContext.addSelectedCell(      /*dataItemName*/                "Product type",                                                                                                                                         /*metadataModelItem*/   "[Great_Outdoors].[Products].[Products].[Product type]",                                                                                                                                        /*useValue*/                    "[Great_Outdoors].[Products].[Products].[Product type]->:[PC].[@MEMBER].[102]",                                                                                                                                        /*useValueType*/                "memberUniqueName",                                                                                                                                        /*displayValue*/                "Tents");                                //Select a column....(product line = "Packs")                                var oProdType2 = oSelectionContext.addSelectedCell(     /*dataItemName*/                "Product type",                                                                                                                                         /*metadataModelItem*/   "[Great_Outdoors].[Products].[Products].[Product type]",                                                                                                                                        /*useValue*/                    "[Great_Outdoors].[Products].[Products].[Product type]->:[PC].[@MEMBER].[104]",                                                                                                                                        /*useValueType*/                "memberUniqueName",                                                                                                                                        /*displayValue*/                "Packs");                                //add a special property (one that's in the schema)                                oProdType2.addProperty('LevelUniqueName', '[Great_Outdoors].[Products].[Products].[Product line]');                                                                //The final selection context is made up of the header, the metadata table, the cells and the strings.                                document.getElementById("fSC").value = oSelectionContext.toString();                        }                        //Example 5: Build the selection context for a nested selection including a single value from a single cell                        //                       and a "parent" as would beseen in a higher level of a nested crosstab.                        function BuildMultiSelectTwoChildrenSameParent()                        {                                                                var oSelectionContext   = new CSelectionContext(document.getElementById("fModelPath").value);   //The output selection context                                //Select a column....(product type = "Tents")                                var oProdTypeTents = oSelectionContext.addSelectedCell( /*dataItemName*/        "Product type",                                                                                                                                         /*metadataModelItem*/   "[Great_Outdoors].[Products].[Products].[Product type]",                                                                                                                                        /*useValue*/                    "[Great_Outdoors].[Products].[Products].[Product type]->:[PC].[@MEMBER].[102]",                                                                                                                                        /*useValueType*/                "memberUniqueName",                                                                                                                                        /*displayValue*/                "Personal Accessories");                                //Select a column....(product line = "Packs")                                var oProdTypePacks = oSelectionContext.addSelectedCell( /*dataItemName*/                "Product type",                                                                                                                                         /*metadataModelItem*/   "[Great_Outdoors].[Products].[Products].[Product type]",                                                                                                                                        /*useValue*/                    "[Great_Outdoors].[Products].[Products].[Product type]->:[PC].[@MEMBER].[104]",                                                                                                                                        /*useValueType*/                "memberUniqueName",                                                                                                                                        /*displayValue*/                "Packs");                                //Select a column....(product line = "Personal Accessories")                                var oProdLine = oProdTypeTents.addDefiningCell(         /*dataItemName*/                "Product line",                                                                                                                                         /*metadataModelItem*/   "[Great_Outdoors].[Products].[Products].[Product line]",                                                                                                                                        /*useValue*/                    "[Great_Outdoors].[Products].[Products].[Product line]->:[PC].[@MEMBER].[2103]",                                                                                                                                        /*useValueType*/                "memberUniqueName",                                                                                                                                        /*displayValue*/                "Personal Accessories");                                //Once added, the other addDefiningCell overload can be used                                oProdTypePacks.referenceDefiningCell(oProdLine);                                                                //The final selection context is made up of the header, the metadata table, the cells and the strings.                                document.getElementById("fSC").value = oSelectionContext.toString();                        }                        //Example 6: Build a selection context for illustrating measure based scope.                        function BuildMeasureBasedScope()                        {                                                                var oSelectionContext   = new CSelectionContext(document.getElementById("fModelPath").value);   //The output selection context                                //Select a measure (add more by adding to the childSelections array)...??could also be built from child to parent??                                var oQuantity = oSelectionContext.addSelectedCell(      /*dataItemName*/                "Quantity",                                                                                                                                         /*metadataModelItem*/   "[Great_Outdoors].[Measures].[Quantity]",                                                                                                                                        /*useValue*/                    "1000",                                                                                                                                        /*useValueType*/                "Decimal");                                //The final selection context is made up of the header, the metadata table, the cells and the strings.                                document.getElementById("fSC").value = oSelectionContext.toString();                        }                        //this function launches the goto page with the output from the selection context library.                        function LaunchGotoPage()                        {                                var sGateway                            = document.getElementById('fGateway').value;                                var sModelPath                          = document.getElementById('fModelPath').value;                                var sEncodedModelPath           = sEncodedModelPath = encode64(document.getElementById('fModelPath').value);                                var sTool                                       = "Goto2";                                var sDirectLaunch                       = "true";                                var sLang                                       = "";                                var sRoutingServerGroup         = "";                                var sEncExecutionParameters = "";                                var sAuthoredDrillthru          = "";                                var sModeledDrillthru           = "";                                var sDrillContext                       = document.getElementById('fSC').value;                                                                cognosLaunch('ui.gateway', sGateway,                                                 'ui.tool', sTool,                                                 'directLaunch', sDirectLaunch,                                                 'lang', sLang,                                                'ui.routingServerGroup', sRoutingServerGroup,                                                'encExecutionParameters', sEncExecutionParameters,                                                'authoredDrillthru', sAuthoredDrillthru,                                                'modeledDrillthru', sModeledDrillthru,                                                'modelPath', sModelPath,                                                'drillContext', sDrillContext);                        }                       --></script><h1>Selection Context Library Test Page</h1><!-- Minimum additional parameters necessary to launch the goto page --><h2>The following are values required to launch the Go Topage...</h2><table><tr><td>*Name:</td><td><input type="text" name="fGateway" value="http://localhost/cognos8/cgi-bin/cognos.cgi" size="100"></td></tr><tr><td>*Model:</td><td><input type="text" name="fModelPath" value="/content/package[@name='sales and marketing cube']/model[last()]"size="100"></td></tr><tr><td>Action:</td><td><input type="text" name="fAction" value="filter" size="100" id="Text1"></td></tr><tr><td colspan="2" align="right">* denotes "Required"</td></tr></table><!-- Produce a selection context using the selection context library --><h2>Produce example Selection Contexts using the Selection ContextBuilder Library...</h2><table id="SelectionContextLibraryTable"><tr><td colspan="2">=== Example 1: "Simple Selection" ====<br>OLAP Product Line = "Personal Accessories"<br><button onclick="BuildBasicSelection()" id="Basic" type="button">=== Example 1: "Simple Selection" ====</button></td></tr><tr><td colspan="2">=== Example 2: "Single axis nested Selection===<br>OLAP Product type = "Tents" nested under<br>OLAP Product Line = "Personal Accessories"<br><button onclick="BuildNestedSelection()" id="Nested" type="button">=== Example 2: "Single axis nested Selection===</button></td></tr><tr><td colspan="2">=== Example 3: Measure selection (with nested rowaxis) ===<br>Measure: Quantity<br>Rows: Product type = "Tents" nested under Product Line = "PersonalAccessories"<br>Cols: Year = "2005"<br><button onclick="BuildNestedMeasure()" id="Button2" type="button">=== Example 3: Measure selection (with nested row axis)===</button></td></tr><tr><td colspan="2">=== Example 4: Multi select of same item at theroot (or select) ===<br>Product type = "Tents"<br>Product type = "Packs"<br><button onclick="BuildMultiSelectSameItemAtRoot()" id="Button1"type="button">=== Example 4: Multi select of same item at theselection root (or select) ===</button></td></tr><tr><td colspan="2">=== Example 5: Multi select - two cells have thesame defining cell ===<br>Product type = "Tents"<br>Product type = "Packs"<br><button onclick="BuildMultiSelectTwoChildrenSameParent()" id="Button4" type="button">=== Example 5: Multi select - two cellshave the same defining cell ===</button></td></tr><tr><td colspan="2">=== Example 6: Measure Based Scope ===<br>Quantity = "1000"<br><button onclick="BuildMeasureBasedScope()" id="Button6" type="button">=== Example 6: Measure Based Scope ===</button></td></tr><tr><td width="74">Output<br>Selection<br>Context:</td><td><textarea rows="30" cols="100" name="fSC" id="fSC"></textarea></td></tr><tr><td align="right" colspan="2"><b>Launch the goto page with thisoutput selection context:<br><button onclick="LaunchGotoPage()" id="Button3" type="button">Launch Goto Page</button></b></td></tr></table></body></html>
 |