IBM Cognos BI - Restrict Tree Prompt Selection with JavaScript

Nature of Document: Tip or Technique Product(s): IBM Cognos BI Report Studio Area of Interest: Report Design

Business Analytics

i&m. -o! can send comments.ca.com*legal*copytrade. registered in many "!risdictions #orld#ide.he information contained in this doc!ment is s!&"ect to change #itho!t notice. $ther prod!ct and ser%ice names might &e trademar s of IBM or other companies. s!ggestions. and additions to cscogpp.com.Restrict Tree Prompt Selection with JavaScript Copyright and Trademar s Licensed Materials . some typographical errors or technical inacc!racies may e+ist. © Copyright IBM Corp.echnology team.. IBM does not accept responsi&ility for any ind of loss res!lting from the !se of information contained in this doc!ment. .i&m.his doc!ment is maintained &y the Best Practices.IBM Cognos BI . ' c!rrent list of IBM trademar s is a%aila&le on the (e& at http)**###. Prod!ct and . . 2010 2 IBM. the IBM logo.shtml (hile e%ery attempt has &een made to ens!re that the information in this doc!ment is acc!rate and complete.Property of IBM. Business Analytics . and Cognos are trademar s or registered trademar s of International B!siness Machines Corp.

............................ 4 Assumptions...................................................................................................................................................................4 Purpose...............................................................4 1................................................................................ 4 3 %estrict &ree Prompt 'election $it( )a#a'cript ('tep*by*'tep Instructions)....IBM Cognos BI ......... 4 !clusions and !ceptions............................................................................................................................. 4 Applicability................1 1................................................................................................Restrict Tree Prompt Selection with JavaScript / Ta!le o" Contents 1 Introduction..2 1................ + Business Analytics .............. 4 2 "#er#ie$............................................................3 1..........................

ue applies to I/0 1o. It is an easy to use .1 usin.ue s(ould be t(orou.le &ree Prompt.et to t(e desired mont(.uired to filter t(e report.ue in t(at support for t(ese capabilities may c(an. &(ere may be a ris7 associated $it( t(is tec(ni.e scenarios.44 2. &(is tec(ni.ue for report de#elopers t(at $is( to utili-e a &ree Prompt but re.rap(ical interface t(at allo$s users to . t(eir reports. #alue prompts4 $(ic( may not be as desirable as t(e use of a sin. !" #pplica$ilit% &(is tec(ni. &(e alternati#e to tree prompts $ould be a series of cascadin. and allo$ t(e user to submit a #alue from any displayed le#el $it(in a dimension8s (ierarc(y.3 'P334 2.ue $as created as a proof of concept and does not co#er all usa.nos %eport 'tudio. In some cases4 a tree prompt may be desirable for a #alue selection4 but only one of t(e le#els is re. A tree prompt can be used to allo$ t(e user to .ate t(rou.ue re.Restrict Tree Prompt Selection with JavaScript 0 Introduction ! Purpose &(is document describes a tec(ni.( t(e years and .ue applies to sin. In t(ese cases4 t(e report de#eloper may $ant to restrict t(e #alue submitted t(rou. &(is tec(ni. In t(is case4 t(e 0ont( le#el.nated le#el $it(in a (ierarc(y.14 and 15. " *verview &ree Prompts are used in dimensional reportin.uic7ly na#i.( a &ree Prompt to a specific le#el in t(e dimension8s (ierarc(y.le*select tree prompts only. !& #ssumptions &(is document assumes e!perience de#elopin. Business Analytics .uic7ly .4. used on a li#e I/0 1o.nos 2. &(is tec(ni. t(e 6reat "utdoor 'ales (cube) sample s(ipped $it( t(e product.uarters to . 9or e!ample4 a report (as a filter on t(e mont( le#el.(ly tested before bein.et to t(e #alue or #alues t(ey are concerned $it( $(en filterin. !' ()clusions and ()ceptions &(is tec(ni.e or be dropped entirely in some future release.IBM Cognos BI .uires t(e use of undocumented and unsupported capabilities in I/0 1o. dimensional reports in I/0 1o.nos /I.nos /I system.uire t(at t(e #alue submitted be restricted to a desi.

1.e.[Years].4 select <se e!istin. parameter4 and t(en select 0ont( from t(e drop do$n list. Business Analytics .[Years]. &(e 0ont( calculation (as t(e follo$in. e!pression. steps.i-ard dialo.IBM Cognos BI .e to t(e report. a tree prompt t(at uses )a#a'cript to restrict a member selection at t(e mont( le#el of t(e :ears dimension.[Month]->?Month? &o en(ance t(is report $it( a tree prompt t(at restricts user selection to t(e 0ont( le#el4 use t(e follo$in. &(e report in t(is e!ample is a simple crosstab report $it( %e#enue as t(e measure4 Product lines on t(e ro$s4 and a . Add a &ree Prompt to t(e prompt pa. 3. &(e follo$in.Restrict Tree Prompt Selection with JavaScript 1 & Restrict Tree Prompt Selection with JavaScript +Step-$%-Step Instructions. 2. [great_outdoors_sales_en]. $ill s(o$ an e!ample of implementin. In t(e Prompt . Add a prompt pa.uery calculation called 0ont( on t(e columns t(at prompts for a specific mont( from t(e :ears (ierarc(y of t(e :ears dimension.

?.Restrict Tree Prompt Selection with JavaScript 2 4.e.) beside =alues to use4 and t(en select t(e :ears (ierarc(y under t(e :ears dimension.IBM Cognos BI .. step. 'elect t(e &ree prompt on t(e prompt pa.e4 and t(en in t(e Properties pane4 in t(e Name property under 0iscellaneous4 enter 0y&reePrompt. 1lic7 ">4 and t(en clic7 9inis(. Add an A&0B Item to prompt pa.. Business Analytics . +. 1lic7 Ne!t4 clic7 t(e ellipsis (. &(is name $ill be referenced in t(e )a#a'cript code you $ill use in an upcomin. &(is allo$s t(e &ree prompt to display all members of t(e (ierarc(y. @.

getLevel !) if selectedLevel *( +! for selectedLevel 3 .You &ust &a3e a selection.Set level nu&-er that should -e selected " alert .!) #ith that na&e has -een found 0 <.alert #hen #rong level is selected 0else " pro&pt1utton2inish !) 0 0else " alert . code.alert #hen no tree pro&pt C.!) . "n t(e prompt pa.treeM$Tree%ro&pt. 1lic7 ">.!) 0 . code to it.treeM$Tree%ro&pt.IBM Cognos BI .2inish..script> 0 .Select a Month for this /eport.-utton. Double*clic7 t(e A&0B item and add t(e follo$in. value(. 11.getLastSelected'ode !) " var selectedLevel ( #indo#.getLastSelected'ode !.treeM$Tree%ro&pt! if selectedTree'ode*(null! " var selectedTree'ode ( #indo#. on4lic3(. class(.> Business Analytics .e4 delete t(e e!istin..alert if no ite& has -een selected 0else " alert . <input t$pe(.-p...treeM$Tree%ro&pt is undefined. 9inis( button and in its place add anot(er A&0B item.. 15.getSelectedTreeLevel !.Restrict Tree Prompt Selection with JavaScript 2. Double*clic7 t(e A&0B item and add t(e follo$in. <script> function getSelectedTreeLevel ! " if #indo#.

4 Business Analytics . %un t(e report4 and t(en clic7 t(e 9inis( button.Restrict Tree Prompt Selection with JavaScript 12.IBM Cognos BI .

1lic7 ">4 select a member from t(e Duarter le#el4 and t(en clic7 9inis(.IBM Cognos BI . &(e report runs and filters t(e report based on t(e tree prompt selection. 5 14. Business Analytics . 1lic7 ">4 select a member from t(e 0ont( le#el4 and t(en clic7 9inis(.Restrict Tree Prompt Selection with JavaScript 13.