Prompts and Parameter Maps in Framework Manager Product(s): IBM Cognos ReportNet, IBM Cognos 8, IBM Cognos 10 Area of Interest: Modeing !e"i#iit$ IBM Cognos BI - Modeling with Prompts and Parameter Maps in Framework Manager 2
Copyright Copyright 2008 Cognos ULC (formerly Cognos Incorporated). Cognos ULC is an IBM Company. hile e!ery attempt has "een made to ens#re that the information in this doc#ment is acc#rate and complete$ some typographical errors or technical inacc#racies may e%ist. Cognos does not accept responsi"ility for any &ind of loss res#lting from the #se of information contained in this doc#ment. 'his doc#ment sho(s the p#"lication date. 'he information contained in this doc#ment is s#")ect to change (itho#t notice. *ny impro!ements or changes to the information contained in this doc#ment (ill "e doc#mented in s#"se+#ent editions. 'his doc#ment contains proprietary information of Cognos. *ll rights are reser!ed. ,o part of this doc#ment may "e copied$ photocopied$ reprod#ced$ stored in a retrie!al system$ transmitted in any form or "y any means$ or translated into another lang#age (itho#t the prior (ritten consent of Cognos. Cognos and the Cognos logo are trademar&s of Cognos ULC (formerly Cognos Incorporated) in the United -tates and.or other co#ntries. IBM and the IBM logo are trademar&s of International B#siness Machines Corporation in the United -tates$ or other co#ntries$ or "oth. *ll other names are trademar&s or registered trademar&s of their respecti!e companies. Information a"o#t Cognos prod#cts can "e fo#nd at www.cognos.com 'his doc#ment is maintained "y the Best /ractices$ /rod#ct and 'echnology team. 0o# can send comments$ s#ggestions$ and additions to cscogpp1ca.i"m.com . IBM Cognos Proprietar$ Infor%ation IBM Cognos BI - Modeling with Prompts and Parameter Maps in Framework Manager 3
Contents 1 IN&R'()C&I'N****************************************************************************************************+ 1*1 P)RP',-******************************************************************************************************************+ 1*. APP/ICABI/I&0*************************************************************************************************************+ 1*1 -2C/),I'N, AN( -2C-P&I'N,*******************************************************************************************+ . MINIMI3-( ,4/****************************************************************************************************5 1 M-&A(A&A CAC6IN7*********************************************************************************************8 1*1 96A& I, M-&A(A&A CAC6IN7:******************************************************************************************8 1*. 96-N CAN M-&A(A&A N'& B- CAC6-(:********************************************************************************8 + ),IN7 PARAM-&-R MAP,**************************************************************************************8 +*1 ,4/ IN (A&A ,')RC- 4)-R0 ,)B;-C&,******************************************************************************< +*. M'(-/ MAIN&-NANC-**************************************************************************************************10 +*1 CA/C)/A&I'N AN( !I/&-R 'B;-C&,***********************************************************************************1. 5 ),IN7 PR'MP&,*************************************************************************************************1+ 5*1 ,4/ IN (A&A ,')RC- 4)-R0 ,)B;-C&,****************************************************************************1+ 5*. M'(-/ MAIN&-NANC-**************************************************************************************************15 5*1 CA/C)/A&I'N AN( !I/&-R 'B;-C&,***********************************************************************************18 8 7-N-RA/ R-C'MM-N(A&I'N,****************************************************************************18 IBM Cognos Proprietar$ Infor%ation IBM Cognos BI - Modeling with Prompts and Parameter Maps in Framework Manager 4
1 Introduction 1.1 Purpose &=is docu%ent outines proven practices for using pro%pts and para%eter %aps in ReportNet and IBM Cognos BI (!ra%e>or? Manager) to increase %ode fe"i#iit$, decrease %aintenance, and i%prove perfor%ance* &=is docu%ent addresses t=e effects of para%eter %aps and pro%pts on ,4/ generation* 't=er factors suc= as di%ensiona infor%ation and deter%inants pa$ a roe in generating ,4/, #ut t=at is not covered in t=is docu%ent* (ifferences #et>een Mode 4uer$ ,u#@ects (M4,) and (ata ,ource 4uer$ ,u#@ects ((4,) >i #e touc=ed on >=ere appica#e* 1.2 pplica!ilit" &=e tec=niAues and product #e=aviours outined in t=is docu%ent app$ to IBM Cognos ReportNet (tested in MR.), IBM Cognos 8*"*, and IBM Cognos 10* A versions >i #e referred to as IBM Cognos BI in t=is docu%ent e"cept >=ere version specific infor%ation is reAuired* 1.3 #$clusions and #$ceptions ,tate%ents regarding %etadata cac=ing #e=aviours %a$ c=ange in future reeases* IBM Cognos Proprietar$ Infor%ation IBM Cognos BI - Modeling with Prompts and Parameter Maps in Framework Manager %
2 Minimi&ed '() &=e Auer$ engine #e=ind IBM Cognos BI >or?s to reduce t=e ,4/ >=ere possi#e to t=e east set of cou%ns and ta#es reAuired to process a given Auer$* &=e #enefit to t=is is t=at >it= t=e %ini%a set of cou%ns and ta#es incuded in a ,4/ e"pression t=en t=e data#ase Auer$ panner is %ore i?e$ to use t=e opti%a pat= for returning t=e reAuired data* &=is appies eAua$ to inde"es and %ateriaiBed Auer$ ta#es t=at t=e given data#ase %a$ =ave in pace* A good e"a%pe of t=is is Auer$ing a ta#e, &a#eA, >=ic= =as an aggregated vie> #ased on Cou%nA and t=e su% of Cou%nB* &=e foo>ing state%ent >oud trigger t=e use of t=e preCco%puted aggregate data fro% t=e data#ase: SELECT ColumnA, SUM(ColumnB) FROM TableA GROUP BY ColumnA 6o>ever, incuding a cou%n t=at is not incuded in t=e aggregated dataset >oud force t=e Auer$ panner to disregard t=e preCco%puted aggregates as a possi#iit$ for resoving t=e Auer$* An e"a%pe of suc= a state%ent >oud #e: SELECT ColumnA, ColumnC, SUM(ColumnB) FROM TableA GROUP BY ColumnA, ColumnC &=e incusion of Cou%nC coud potentia$ resut in a fu scan of &a#eA if t=ere are no ot=er aggregates or inde"es to prevent suc= an access pat=* Deep in %ind t=at %an$ data#ases provide Auer$ re>rite capa#iities* 9it= suc= a feature t=e ,4/ state%ent >i #e re>ritten into anot=er state%ent t=at is functiona$ eAuivaent* ,o if >e ta?e t=e foo>ing e"a%pe SELECT T1.ColumnA, SUM(T1.ColumnB) FROM (SELECT ColumnA, ColumnC, SUM(ColumnB) as ColumnB FROM TableA GROUP BY ColumnA, ColumnC) as T1 GROUP BY ColumnA t=en #$ re>riting t=is state%ent to t=e functiona eAuivaent, >e get t=e sa%e resut as t=e first e"a%pe state%ent SELECT ColumnA, SUM(ColumnB) IBM Cognos Proprietar$ Infor%ation IBM Cognos BI - Modeling with Prompts and Parameter Maps in Framework Manager *
FROM TableA GROUP BY ColumnA &=e a#ove e"a%pe s=o>s =o> Auer$ re>rite serves to refor% t=e ,4/ into t=e functiona eAuivaent >it=out derived ta#es or unnecessar$ cou%n references* 6o>ever, for t=e sa?e of t=ose data#ases >=ic= are not capa#e of suc= re>rites and to %a?e t=e ,4/ %ore egi#e, t=e ai% of a %odeer s=oud #e to create Auer$ su#@ects t=at are egi#e, efficient, and %aintaina#e* 3 Metadata Caching 3.1 +hat is metadata caching, Metadata in t=e conte"t of !ra%e>or? Manager is a t=e infor%ation stored >it=in t=e %ode t=at descri#es t=e o#@ects >it=in a data source and t=e %anipuated o#@ects created fro% $our data source* In %ost standard scenarios, a t=e properties reAuired to descri#e an o#@ect in !ra%e>or? Manager >i #e captured during t=e i%port fro% a data source* 6o>ever, t=ere are ti%es >=en c=anges to t=e %ode >i resut in Auer$ su#@ects t=at coud potentia$ =ave var$ing properties* In cases >=ere t=e %etadata cannot #e cac=ed in t=e %ode, t=en >=en running a report t=e infor%ation %ust #e fetc=ed fro% t=e data source direct$* 'nce t=e infor%ation is fetc=ed fro% t=e data source, it >i #e cac=ed for t=e duration of t=e connection to t=e data source* 6o>ever, retrieving t=e %etadata fro% a data source can add over=ead to $our co%pe" reports* 3.2 +hen can metadata not !e cached, &=ere are severa %ain ite%s >=ic= >i disa#e t=e a#iit$ to t=e %etadata stored >it=in t=e %ode* IBM Cognos Proprietar$ Infor%ation IBM Cognos BI - Modeling with Prompts and Parameter Maps in Framework Manager -
1* -na#ing t=e EAo> en=anced %ode porta#iit$ at run ti%eF option in t=e pro@ect governors >i force t=e fetc=ing fro% t=e data#ase* &urning on t=is governor disa#es t=e use of %etadata fro% t=e %ode* )ness t=e %ode is #eing used in %utipe environ%ents >=ere t=e cou%ns in t=e data#ase coud potentia$ c=ange in data t$pe t=en t=is setting s=oud #e eft disa#ed during production use of t=e %ode* &=ere are cases suc= as during a %ode upgrade fro% ReportNet to IBM Cognos 8 and =ig=er >=ere t=e %etadata s=oud not #e preserved so t=at a su#seAuent res$nc=roniBation of t=e %ode can appropriate$ update t=e data t$pes of t=e %odeed data ite%s* Note: &=e 7overnors diaog %a$ appear different$ depending on >=ic= version of IBM Cognos !ra%e>or? Manager $ou are >or?ing >it=* IBM Cognos Proprietar$ Infor%ation IBM Cognos BI - Modeling with Prompts and Parameter Maps in Framework Manager .
.* Modifications to a (4, ,4/ e"pression can aso disa#e cac=ing of t=e %etadata* &=is depends on t=e co%pe"it$ of t=e state%ent* 6o>ever for %ost scenarios t=e reasons for %odif$ing a ,4/ e"pression are nonCtrivia and t=e c=anges >i %ost often resut in a nonCtrivia ,4/ state%ent >=ere %etadata cannot #e cac=ed* )sing Para%eter %aps, Pro%pts, aggregates or fiters >it=in a (4, ,4/ e"pression >i resut in retrieva of t=e %etadata fro% t=e data#ase rat=er t=an capturing t=e infor%ation >it=in t=e %ode* In t=e IBM Cognos 8 MR1 reease and #e$ond, it is possi#e to get feed#ac? on %etadata cac=ing >it=in !ra%e>or? Manager* 9=en testing a Auer$, t=ere is additiona infor%ation provided on t=e E4uer$ Infor%ationF under EResponseF* As seen #eo> t=ere is an infor%ationa %essage provided >=en %etadata cannot #e cac=ed in t=e %ode* &=e foo>ing sections >i outine options for designing !ra%e>or? Manager %odes to avoid t=is #e=aviour* 6o>ever, in e"isting %odes, it %a$ prove difficut to redesign according to t=e foo>ing sections* In suc= cases it is possi#e to create a set of Auer$ su#@ects to provide t=e cac=ed %etadata* &o do so, one >oud create a ne> na%espace and i%port a of t=e ta#es into t=is ne> na%espace* B$ eaving t=ese ne>$ i%ported Auer$ su#@ects un%odified !ra%e>or? Manager >i #e a#e to reference t=e% as t=e trivia (B Auer$ su#@ect reAuired to satisf$ t=e %etadata cas for ot=er Aueries in t=e %ode* IBM Cognos Proprietar$ Infor%ation IBM Cognos BI - Modeling with Prompts and Parameter Maps in Framework Manager /
4 0sing Parameter Maps Para%eter %aps are an invaua#e %et=od for su#stituting e"pressions and vaues into a Auer$ su#@ect* A pri%e e"a%pe of t=is functionait$ is avaia#e >it=in t=e 7' (ata 9are=ouse sa%pe %ode >=ere a para%eter %ap serves to provide t=e capa#iities for reporting in %utipe data anguages depending on t=e user ocae preference settings* An additiona co%%on appication >oud incude repacing data source connection infor%ation #ased on t=e user ogon* An$ pace >=ere a static fra%e>or? for a Auer$ su#@ect is reAuired #ut t=e detaied definition >it=in t=e Auer$ is varia#e >oud #e a pace >=ere a para%eter %ap can #e appied* 4.1 '() in 1ata 'ource (uer" 'u!2ects In earier versions of t=e 7' (ata 9are=ouse sa%pe $ou >i find t=e para%eter %ap E/anguageGoo?upF #eing used in t=e EProduct ineF (4, as foo>s: Selec PRO!UCT"L#$E.PRO!UCT"L#$E"CO!E, PRO!UCT"L#$E.PRO!UCT"L#$E"%&Lan'ua'e"loo(u)*&+unLocale, % AS PRO!UCT"L#$E -+om .'o"/aa"0a+e1ouse2.PRO!UCT"L#$E &=e para%eter %ap is ?e$ed to t=e run/ocae and provides t=e appropriate postfi" to t=e cou%n reference in t=e ,4/ state%ent* In t=e case of an -ngis= ocae (en, enCus, enCca, etc*) t=e state%ent >oud seect t=e EPR'()C&G/IN-G#3F cou%n for use >it=in t=is (4, >=ie !renc= ocaes >oud use EPR'()C&G/IN-GF4F* &=is e"a%pe is t=e ?e$ to providing %utiingua data to report aut=ors >it=out co%picated user interaction to pic? t=e desired anguage cou%n for t=eir reporting* '#vious$ t=is is a vaua#e tec=niAue #ut t=ere are a coupe of ite%s to consider for t=e a#ove e"a%pe* &=e first ite% for consideration is t=at t=e use of t=e para%eter %ap in t=e ,4/ of a (4, %eans t=at t=e state%ent is no onger trivia and t=e ,4/ cannot #e %ini%iBed* As a resut $ou >oud e"pect to see t=e a#ove state%ent as a derived ta#e >=en used in $our report Aueries regardess of >=et=er $ou are seecting one or #ot= of t=e cou%ns defined #$ t=is Auer$ su#@ect* IBM Cognos Proprietar$ Infor%ation IBM Cognos BI - Modeling with Prompts and Parameter Maps in Framework Manager 15
,econd, t=e %etadata for t=e Auer$ su#@ect cannot #e cac=ed in t=e %ode #ecause t=e definition of t=e PR'()C&G/IN- cou%n is d$na%ic in nature* !ro% one ocae to t=e ne"t $ou %a$ receive different cou%ns or e"pressions >it= potentia$ different data t$pes* &=e end resut is t=at a ca %ust #e %ade to t=e data#ase >=en t=e Auer$ is e"ecuted to deter%ine t=e properties of t=e reevant cou%n used #$ PR'()C&G/IN-* 4.2 Model Maintenance &=e core of creating an$ %aintaina#e appication is in %a?ing t=e appication reada#e and %a?ing t=e c=ange process eas$ for future ad%inistrators* Para%eter %aps are e"tre%e$ usefu for #uiding fe"i#iit$ into %odes #ased on pro%pts or session para%eters* )nfortunate$ it is eas$ to get carried a>a$ and #uid too %uc= into #eing dependent on para%eter %aps to satisf$ a reAuest* ,uc= overuse can resut in Auer$ su#@ects t=at are difficut to %aintain* !irst, t=e diaog for creating Para%eter Maps is not a fuCfedged e"pression editor #ecause t=e infor%ation stored >it=in a para%eter %ap is %ost often a frag%ent of an e"pression rat=er t=an a fu, s$ntactica$ correct, state%ent* )sing ong vaues in t=e para%eter %ap interface can #eco%e a %aintenance issue as t=e e"pressions %a$ not #e fu$ visi#e >it=in t=e fra%e aocated for t=e para%eter %ap vaue* ,econd, >=en using para%eter %aps one %ust a>a$s consider =o> infor%ation is stored >it=in t=e para%eter %ap vaues* &=e vaues are actua$ stored as static strings >it=out reference to an$ ot=er o#@ects in $our %ode* &=e vaues e"ist unto t=e%seves and are not evauated for s$nta" vaidit$ >it=in t=e conte"t of a Auer$* 9=en testing a Auer$ su#@ect it is on$ possi#e to vaidate one vaue fro% t=e para%eter %ap at a ti%e* !or e"a%pe, a para%eter %a$ contain a vaue >=ic= is #ad$ for%ed or =as s$nta" errors* If t=e Auer$ su#@ect t=at uses t=e para%eter %ap does not reference t=e %afor%ed vaue >=en testing t=en t=e deveoper >i not #e a>are t=at t=e invaid s$nta" is present in t=e para%eter %ap unti reports #egin to ca t=e invaid para%eter %ap vaue containing t=e %afor%ed s$nta"* !or t=e sa?e of %aintaining and vaidating co%pe" cacuations a #etter approac= is to create t=e e"pressions as individua cacuation o#@ects* &=is >a$ t=e vaidit$ of a t=e e"pressions can #e c=ec?ed i%%ediate$ and feed#ac? on individua cacuations >=ic= %a$ #e s$ntactica$ invaid >i #e dispa$ed >it=in t=e fuCfedged e"pression editor*
IBM Cognos Proprietar$ Infor%ation IBM Cognos BI - Modeling with Prompts and Parameter Maps in Framework Manager 11
A para%eter %ap can t=en #e created to reference t=ese cacuations rat=er t=an storing t=e fu cacuation e"pression itsef* ,i%iar$, fiters can #e created as fiter o#@ects >it=in t=e %ode and a para%eter %ap can reference t=e fiter o#@ect fro% t=e %ode rat=er t=an defining t=e fu Booean e"pressions >it=in t=e para%eter %ap vaues* IBM Cognos Proprietar$ Infor%ation IBM Cognos BI - Modeling with Prompts and Parameter Maps in Framework Manager 12
Additiona$, t=e overuse of para%eter %aps can o#fuscate t=e purpose of a Auer$ su#@ect #$ %a?ing it uncear to an$one ot=er t=an t=e origina aut=or* &=e foo>ing (4, definition is an e"a%pe of suc= a scenario: Select #$Tme!Loo"u#$%&AY%'#, #$Tme!Loo"u#$%(EE)%'#, #$Tme!Loo"u#$%MO*T+%'#, #$Tme!Loo"u#$%,UARTER%'#, #$Tme!Loo"u#$%YEAR%'#, #$Tme!Loo"u#$%(!%-$Lan.ua.e!loo"u#$$/unLocale''# a0 (EE)&AY, #$Tme!Loo"u#$%M!%-$Lan.ua.e!loo"u#$$/unLocale''# a0 MO*T+1 2/om 3.o!4ata!5a/e6ou0e78T9ME!&9ME*S9O* Based on t=e use of t=e E&i%eG/oo?upF para%eter %ap t=ere is no >a$ of teing >=at t=e resuting ,4/ >i return #$ visua inspection* In t=is particuar instance t=e para%eter %ap >as constructed to %i%ic t=e origina E&i%e di%ensionF Auer$ su#@ect fro% t=e 7' (ata 9are=ouse sa%pes >=ic= =as t=e foo>ing structure: Select T9ME!&9ME*S9O*8&AY!)EY, T9ME!&9ME*S9O*8&AY!&ATE, T9ME!&9ME*S9O*8MO*T+!)EY, T9ME!&9ME*S9O*8CURRE*T!MO*T+, T9ME!&9ME*S9O*8,UARTER!)EY, T9ME!&9ME*S9O*8CURRE*T!,UARTER, T9ME!&9ME*S9O*8CURRE*T!YEAR, T9ME!&9ME*S9O*8&AY!OF!(EE), T9ME!&9ME*S9O*8&AY!OF!MO*T+, T9ME!&9ME*S9O*8&AYS!9*!MO*T+, T9ME!&9ME*S9O*8&AY!OF!YEAR, T9ME!&9ME*S9O*8(EE)!OF!MO*T+, T9ME!&9ME*S9O*8(EE)!OF!,UARTER, T9ME!&9ME*S9O*8(EE)!OF!YEAR, T9ME!&9ME*S9O*8(EE)&AY!#$Lan.ua.e!loo"u# $$/unLocale' # AS (EE)&AY, T9ME!&9ME*S9O*8MO*T+!#$Lan.ua.e!loo"u# $$/unLocale' # AS MO*T+1 2/om 3.o!4ata!5a/e6ou0e78T9ME!&9ME*S9O* IBM Cognos Proprietar$ Infor%ation IBM Cognos BI - Modeling with Prompts and Parameter Maps in Framework Manager 13
&=e second state%ent s=o>s a %uc= cearer purpose for t=e ti%e di%ension and %a?es it i%%ediate$ o#vious >=ic= cou%ns are reAuired for t=e Auer$ su#@ect* &=e prior version using t=e E&i%eG/oo?upF %ap =ides t=e fact t=at severa of t=e para%eter %ap ?e$s return coections of cou%ns to t=e Auer$ su#@ect definition* &=e E(A0F ?e$ for e"a%pe returns t=e foo>ing cou%ns: (A0GD-0, (A0G(A&-, (A0G'!G9--D, (A0G'!GM'N&6, and (A0G'!G0-AR* 6o>ever, as seen in t=e ne"t section, t=e preferred approac= to t=e a#ove ,4/ state%ent >oud #e to create an M4, and >it=in it create cacuation o#@ects for t=e 9--D(A0 and M'N&6 so t=at t=e ,4/ in t=e (4, can #e reduced to Eseect H fro% IF 4.3 Calculation and Filter 6!2ects &=e preferred option for using para%eter %aps is to incude para%eter %aps in M4, cacuation or fiter o#@ects or as stand aone cacuation or fiter o#@ects rat=er t=an >it=in t=e ,4/ e"pression of t=e origina (4,* B$ eaving t=e origina (4, ,4/ in a pristine i%port state, >e can ensure t=at no factors >i #e present t=at >i prevent eit=er %ini%iBed ,4/ or %etadata cac=ing >it=in t=e %ode* &=e s$nta" for using para%eter %aps in cacuation or fiter o#@ects is si%iar to referencing t=e% in ,4/ state%ents >it= t=e e"ception t=at an$ references to cou%ns >oud #e c=anged to reference t=e associated data ite% fro% a (4,* !ro% t=e prior section >e sa> an e"a%pe of para%eter %aps #eing used to c=oose a cou%n #ased on a given ocae* B$ resetting t=e EProduct ineF (4, to use Selec 3 -+om .'o"/aa"0a+e1ouse2.PRO!UCT"L#$E t=e (4, >i t=en ist a of t=e cou%ns fro% t=e PR'()C&G/IN- ta#e* B$ creating a ne> M4, or a stand aone cacuation >it= t=e sa%e para%eter %ap, it is possi#e to do t=e sa%e cou%n seection as in t=e origina ,4/ state%ent* #%3P/o4uct 4men0on783P/o4uct lne783PRO&UCT!L9*E!%- $Lan.ua.e!loo"u#$$/unLocale'- %7%# &=e %acro e"pression serves to generate t=e reference to t=e %ode ite% reAuired* &=e first portion of t=e state%ent serves to identif$ t=e na%espace and (4, used to ocate t=e cou%ns for t=e PR'()C&G/IN- a#es* &=e para%eter %ap t=en seects t=e singe data ite% reAuired fro% t=e coection of ocaeCspecific data ite%s @ust as >it= t=e origina custo% ,4/ e"pression s=o>n in t=e previous section* IBM Cognos Proprietar$ Infor%ation IBM Cognos BI - Modeling with Prompts and Parameter Maps in Framework Manager 14
&=e #enefit to t=is approac= is t=at t=e resuting ,4/ for t=e Auer$ su#@ect is %uc= easier to read and t=e %ode stores a t=e reevant %etadata for eac= of t=e cou%ns and prevents a reAuest to t=e data#ase for t=e %etadata to #e provided at runCti%e* IBM Cognos Proprietar$ Infor%ation IBM Cognos BI - Modeling with Prompts and Parameter Maps in Framework Manager 1%
A (4, using t=e custo% ,4/ >it= t=e para%eter %ap >oud provide t=e foo>ing ,4/: selec P+o/uc"l4ne.P+o/uc"l4ne"co/e as P+o/uc"l4ne"co/e, P+o/uc"l4ne.P+o/uc"l4ne as P+o/uc"l4ne -+om (selec P+o/uc"l4ne.PRO!UCT"L#$E"CO!E as P+o/uc"l4ne"co/e, 5M#$(P+o/uc"l4ne.PRO!UCT"L#$E -o+ P+o/uc"l4ne.PRO!UCT"L#$E"CO!E ) as P+o/uc"l4ne -+om (selec PRO!UCT"L#$E.PRO!UCT"L#$E"CO!E, PRO!UCT"L#$E.PRO!UCT"L#$E"E$ as PRO!UCT"L#$E -+om 'o"/aa"0a+e1ouse...PRO!UCT"L#$E ) P+o/uc"l4ne '+ou) b6 P+o/uc"l4ne.PRO!UCT"L#$E"CO!E ) P+o/uc"l4ne 9it= t=e c=anges to use an M4, >it= t=e para%eter %ap, >e o#tain t=e foo>ing ,4/: selec P+o/uc"l4ne.P+o/uc"l4ne"co/e as P+o/uc"l4ne"co/e, P+o/uc"l4ne.P+o/uc"l4ne as P+o/uc"l4ne -+om (selec P+o/uc"l4ne.PRO!UCT"L#$E"CO!E as P+o/uc"l4ne"co/e, 5M#$(P+o/uc"l4ne.PRO!UCT"L#$E"E$ -o+ P+o/uc"l4ne.PRO!UCT"L#$E"CO!E ) as P+o/uc"l4ne -+om 'o"/aa"0a+e1ouse...PRO!UCT"L#$E P+o/uc"l4ne '+ou) b6 P+o/uc"l4ne.PRO!UCT"L#$E"CO!E ) P+o/uc"l4ne &=e ne> M4, approac= to para%eter %aps re%oves t=e inner derived ta#e seecting t=e PR'()C&G/IN-GC'(- and t=e PR'()C&G/IN-G-N* Note t=at t=e 2MIN $ou see in t=e ,4/ is due to t=e Egroup #$F option #eing c=ec?ed for t=e PR'()C&G/IN-GC'(- deter%inant* 9it=out t=is option, t=e ,4/ >oud coapse and re%ove t=e aggregation >it=in t=e ,4/* 6o>ever, in t=is case t=e Egroup #$F option is reAuired for co%paring facts fro% ta#es at different eves of granuarit$* IBM Cognos Proprietar$ Infor%ation IBM Cognos BI - Modeling with Prompts and Parameter Maps in Framework Manager 1*
% 0sing Prompts Pro%pts >it=in a %ode serve a ver$ vaua#e roe in t=at t=e$ ao> users to interact >it= t=e Aueries at a #asic eve* &=is can #uid perfor%ance and functionait$ into a %ode t=at >oud #e difficut to ac=ieve consistent$ in t=e endCuser reporting environ%ent* A good e"a%pe of t=is >oud #e a Auer$ su#@ect designed to generate a set of reative ti%e periods* A pro%pt for a Ecurrent dateF >oud ao> users to report reative ti%e periods starting at an$ ar#itrar$ date* Recreating t=is t$pe of reporting in Report ,tudio is difficut due to t=e co%pe"it$ of t=e Aueries reAuired to generate t=e date ranges* !urt=er, recreating t=ese Aueries in %an$ reports can #e #ot= tedious and prone to errors* %.1 '() in 1ata 'ource (uer" 'u!2ects As >it= para%eter %aps, >=en using a pro%pt in (4, ,4/, t=e addition of t=e pro%pt %eans t=at t=e ,4/ is no onger trivia* 9=en t=e Auer$ #eco%es nonCtrivia it is evauated as a >=oe to deter%ine #ot= t=e native ,4/ and t=e %etadata associated >it= t=e data ite%s* In t=is case a ca to t=e data source %a$ #e %ade at runCti%e to fetc= t=e data ite% properties* !or so%e data sources, t=e function cas >it=in t=e data#ase reAuired to perfor% t=is %etadata fetc= can account for severa seconds of dea$ during t=e prepare p=ase of t=e Auer$ e"ecution >=ie IBM Cognos BI is >aiting for t=e data source to return t=e reAuired infor%ation* ,ince t=e ,4/ is evauated as a unit, t=e pro%pt >i #e dispa$ed to users an$ ti%e t=at t=e Auer$ su#@ect is referenced* In so%e cases t=is is good as it enforces a #usiness rue to retrieve user input ever$ ti%e t=e reAuest is su#%itted* In ot=er cases suc= as >=en t=e pro%pt is used in a cacuation t=at %a$ or %a$ not #e reAuired #$ t=e end report, t=en t=e pro%pting %a$ #e considered unnecessar$ fro% a user perspective* An e"a%pe >=ere t=e pro%pt >oud, #$ definition, a>a$s #e presented to t=e user >oud #e: Selec 3 -+om .'o"/aa"0a+e1ouse2.PRO!UCT"L#$E PRO!UCT"L#$E 71e+e PRO!UCT"L#$E.PRO!UCT"L#$E"CO!E 8 %)+om)(9P+o/uc L4ne Co/e:, 94ne'e+:)% 6ere t=e user >i #e forced to seect on$ one Product /ine at a ti%e for reporting and >oud not #e a#e to report against %utipe Product /ine vaues >it=in t=e sa%e Auer$* IBM Cognos Proprietar$ Infor%ation IBM Cognos BI - Modeling with Prompts and Parameter Maps in Framework Manager 1-
IBM Cognos Proprietar$ Infor%ation IBM Cognos BI - Modeling with Prompts and Parameter Maps in Framework Manager 1.
An e"a%pe of >=en t=e pro%pt %a$ not #e desira#e >=en reporting is: Selec 3, Case PRO!UCT"L#$E.PRO!UCT"L#$E"CO!E 71en %)+om)(9Ta+'e P+o/uc L4ne Co/e:, 94ne'e+:, 91:)% 1en 1 Else ; En/ as <Ta+'e P+o/uc L4ne= -+om .'o"/aa"0a+e1ouse2.PRO!UCT"L#$E PRO!UCT"L#$E 6ere t=e E&arget Product /ineF cacuation %a$ serve to identif$ a set of vaues t=at can #e used a as a #aseine for co%parison >it= ot=er Product /ines* 6o>ever, even if t=e user does not incude t=e E&arget Product /ineF data ite% in t=eir report, t=e$ >i #e pro%pted to provide a Product /ine #ecause t=e pro%pt is essentia to evauating t=e fu definition of t=e (4,* %.2 Model Maintenance &=e driving force #e=ind pro%pts >it=in a %ode is t$pica$ for specific #usiness rues or reporting appications* 9=en capturing co%%on pro%pting scenarios in t=e %ode, t=e end users are forced to satisf$ a particuar pro%pt na%e to e"ecute t=e Auer$* !or si%pe cases suc= as 4uer$ ,tudio and Ana$sis ,tudio, a singe pro%pt na%e >i =ave itte i%pact on t=e a#iit$ of a user to create t=eir desired Aueries* !or po>er users of Report ,tudio, a singe si%pistic pro%pting scenario can #e i%iting* A good e"a%pe of t=is is t=e reative ti%e scenario %entioned earier* B$ #uiding a singe date pro%pt into t=e reative ti%e Auer$ su#@ect, it is possi#e to generate %utipe periods suc= as Mont=C&oC(ate and 0earC&oC (ate to ao> for eas$ reporting of reative ti%e fro% a reationa source* 6o>ever, if a Report ,tudio aut=or >anted to generate t>o Aueries in a singe report t=at used different starting dates for t=e reative ti%e Auer$ su#@ect (sa$ one used (ece%#er as t=e current %ont= >=ie anot=er >oud use 'cto#er), t=en t=ere >oud #e difficuties as t=e singe pro%pt na%e >oud drive a t=e Aueries t=at used t=e reative ti%e Auer$ su#@ect and $ou coud on$ report fro% one Ecurrent periodF at a ti%e* &=is t$pe of scenario coud drive users to reAuest %utipe instances of t=e pro%pted Auer$ su#@ect to #e created in t=e %ode using different pro%pt na%es* &=is can Auic?$ scae out of contro as t=e arge scae deveop%ent of %an$ redundant Auer$ su#@ects in a %ode >i great$ increase %aintenance costs* IBM Cognos Proprietar$ Infor%ation IBM Cognos BI - Modeling with Prompts and Parameter Maps in Framework Manager 1/
In scenarios >=ere a Auer$ su#@ect or cacuation >i #e used #$ report aut=ors in %an$ >id$ var$ing appications, it %a$ #e #est to eave t=e pro%pting to t=e individua report aut=ors as it is difficut to foresee ever$ possi#e appication t=at a user >i need to generate for reporting* %.3 Calculation and Filter 6!2ects Near$ an$ pro%pting scenario can #e captured in an M4, or stand aone fiter o#@ect* If >e ta?e t=e previous e"a%pes, t=e first case can #e defined using a fiter o#@ect as: .P+o/uc /4mens4on2..P+o/uc l4ne2..PRO!UCT"L#$E"CO!E2 8 %)+om) (9P+o/uc L4ne Co/e:, 94ne'e+:, 91:)% ,i%iar$, t=e case state%ent s=o>n previous$ can #e defined as t=e foo>ing cacuation in an M4, or stand aone cacuation: Case .P+o/uc /4mens4on2..P+o/uc l4ne2..PRO!UCT"L#$E"CO!E2 71en %)+om)(9Ta+'e P+o/uc L4ne Co/e:, 94ne'e+:, 91:)% 1en 1 Else ; En/ &=e difference >=en using cacuation o#@ects is t=at t=e E&arget Product /ine CodeF pro%pt is no onger reAuired if t=e cacuation is not used in t=e userJs report* If t=e cacuation is not incuded in t=is case, t=en t=ere is no need to add it >=en referencing t=e #ase ,4/ state%ent fro% t=e (4, or to prepare t=e ,4/ for t=e reAuest* Aso >=en using cacuations and fiter o#@ects in M4,s or as stand aone o#@ects, t=e (4, ,4/ state%ent can #e eft untouc=ed and t=e ,4/ >i re%ain trivia* &=is ei%inates t=e need to fetc= %etadata data fro% a data source connection as t=e infor%ation can #e cac=ed >it=in t=e %ode and %aintains t=e a#iit$ to %ini%iBe t=e ,4/* * 7eneral 4ecommendations In practice, it is #etter to use para%eters and pro%pts >it=in M4, or stand aone cacuation and fiter o#@ects rat=er t=an inserting t=e% >it=in t=e ,4/ of a data source Auer$ su#@ect* !oo>ing t=is approac= >i ensure #etter ,4/ generation t=at eads to #etter perfor%ance or #etter %atc=ing >it= under$ing %ateriaiBed vie>s* Para%eter %aps are idea for scenarios >=ere infor%ation needs to #e s>apped d$na%ica$ #ased on session infor%ation or user interaction via pro%pts* As a genera rue, para%eter %aps s=oud #e reserved for t=e foo>ing t>o scenarios* IBM Cognos Proprietar$ Infor%ation IBM Cognos BI - Modeling with Prompts and Parameter Maps in Framework Manager 25
)sing a para%eter %ap great$ si%pifies t=e resuting ,4/ for a Auer$ or e"pression* !or e"a%pe t=e foo>ing cacuation in an M4, referencing cou%ns fro% &a#e1 and &a#e. CASE %)+om)(9P+om) $ame:, 4ne'e+, 9;:)% 7>E$ 1 T>E$ .Table12..Column12 3 .Table?2..Column?2 7>E$ ? T>E$ .Table12..Column?2 ELSE ; E$! can #e con:e/te4 to u0e a #a/amete/ ma# %&Pa+amee+"Ma)* )+om)(9P+om) $ame:, 4ne'e+, 9;:),% 56e/e t6e Pa/amete/ ma# 5oul4 contan t6e 2ollo5n.; De$ Kaue 1 L&a#e1M*LCou%n1M H L&a#e.M*LCou%n.M . L&a#e1M*LCou%n1M &=e defaut vaue of t=e para%eter %ap >oud #e set to Bero so t=at >=en N0J is suppied fro% t=e pro%pt t=e return >oud #e t=e integer vaue of Bero* 9it= t=e para%eter %ap, t=e individua conditions fro% t=e CA,- state%ent can #e inserted as reAuired* &=is potentia$ ei%inates t=e need to @oin to &a#e. for >=en t=e pro%pt vaue eAuas . >=ie t=e origina case state%ent >oud =ave forced t=e @oin #et>een t=e t>o ta#es ever$ ti%e t=e cacuation >as used regardess of t=e user input to t=e generated pro%pt* )sing a para%eter %ap acco%pis=es an operation t=at >oud #e difficut if not i%possi#e for t=e end user* An e"a%pe >oud #e t=e %utiCingua reporting data in t=e sa%pe %odes* Based on t=e user preferences, t=e %ode >i s>ap cou%ns to return t=e appropriate data anguage for reporting* ,i%iar$ a para%eter %ap can #e used to s>ap cou%ns, ta#es, sc=e%as, or even data source connections #ased on para%eters suc= as t=e user I(* &=is coud #e used to %i%ic t=e Kirtua Private (ata#ase functionait$ t=at vendors suc= as 'race are capa#e of, in ot=er data#ases t=at do not natura$ support suc= functionait$* IBM Cognos Proprietar$ Infor%ation IBM Cognos BI - Modeling with Prompts and Parameter Maps in Framework Manager 21
In regards to pro%pt %acros #eing #uit into a %ode, t=e %ain consideration for t=eir use is in foreseeing a possi#e appications t=at a user %a$ generate >it=in t=e Auer$ toos* &$pica$ a pro%pt #uit into a %ode >i restrict so%e of t=e fe"i#iit$ avaia#e to users in one >a$ or anot=er* &=e degree to >=ic= t=ese restrictions i%pact t=e a#iit$ of users to generate t=e Aueries t=e$ need is t=e deciding factor for or against using a pro%pt >it=in a %ode* In practice, >=en generating para%eter %aps and pro%pts >it=in a %ode, it is difficut to see a t=e possi#e scenarios for t=eir use >=en t=e$ are #eing created* In an adC=oc reporting environ%ent, t=is can #e detri%enta as t=e %ode >i tend to direct users aong set Auer$ pat=s deter%ined #$ a para%eter %ap or pro%pt* If para%eteriBation and pro%pting in t=e %ode are ta?en to e"tre%es, t=en t=e resuting Aueries can #eco%e infe"i#e to a point >=ere a Auer$ su#@ect can on$ #e used to ans>er one specific #usiness Auestion* In suc= a scenario t=e tas?s of a report aut=or =ave #een effective$ roed entire$ into t=e %ode* At t=is point t=e over=ead for %ode %aintenance >i #e Auite =ig= as reports >i #e tied to suc= a degree to t=e Auer$ su#@ect definition t=at ne> reports %a$ reAuire deveop%ent of entire$ ne> Aueries >it=in t=e %ode* /i?e>ise, updates to e"isting reports %a$ reAuire invove%ent of t=e %ode deveoper rat=er t=an #eing entire$ >it=in t=e scope of a report aut=orJs capa#iities* B$ carefu panning and i%itation of para%eteriBation and pro%pting to scenarios >=ere t=e$ are a#soute$ reAuired, a %ode deveoper can ensure t=at future %aintenance tas?s >i re%ain si%pe and t=at t=e i%pact of c=ange >i #e %ini%a to t=e report aut=ors* /i?e>ise t=e %ode >i re%ain fe"i#e enoug= to satisf$ t=e adC=oc nature of reporting in toda$Js #usiness >ord* IBM Cognos Proprietar$ Infor%ation