+ All Categories
Home > Documents > Qlikview Addressing the Data Model Issue Synthetic Key Issue

Qlikview Addressing the Data Model Issue Synthetic Key Issue

Date post: 04-Jun-2018
Category:
Upload: amit-sharma
View: 223 times
Download: 0 times
Share this document with a friend

of 19

Transcript
  • 8/13/2019 Qlikview Addressing the Data Model Issue Synthetic Key Issue

    1/19

    Getting Started with QlikView Part XIII

    Addressing the Data model issue (Synthetic Keyissue)

    Descrition!

    BISP is committed to provide BEST learning material to the

    beginners and advance learners. In the same series, we have

    prepared a complete end-to end Hands-on Beginners Gide !or

    "li#view $eport, S%nthetic #e% isse, Sb!ield &nction. The docment!ocses on script editor. 'oin or pro!essional training program and

    learn !rom e(perts.

    Histor%)

    *ersion +escription hange thor Pblish +ate

    ./ Initial +ra!t Srbhi sah 0/st g 0/0

    ./ $eview1/ $a2#mar 3 04thg 0/0

    www.bispsoltions.com www.bisptrainigs.com www.h%periongr.com Page /

    http://www.bispsolutions.com/http://www.bisptrainigs.com/http://www.bispsolutions.com/http://www.bisptrainigs.com/
  • 8/13/2019 Qlikview Addressing the Data Model Issue Synthetic Key Issue

    2/19

    Table of Contents

    Table o! ontents......................................................................................................................... 0

    /5spects related to reloading the application)............................................................................6

    05The Script Editor........................................................................................................................ 7

    0./58en and toolbar................................................................................................................ 7

    0.05 Script pane........................................................................................................................ 9

    0.65 Tool pane.......................................................................................................................... 9

    0.75 Script statement.................................................................................................................9

    65 :oading the aircra!t in!ormation...............................................................................................;

    75S%nthetic #e% isse................................................................................................................. /6

    The problem generated de to s%nthetic #e%........................................................................../7

    ............................................................................................................................................... /7

    ;5oncatenate statement........................................................................................................... /9

  • 8/13/2019 Qlikview Addressing the Data Model Issue Synthetic Key Issue

    3/19

    1) Aspects related to reloading the application:s we !amiliar abot the reload !nction is to load the data !rom di!!erent data sorces into the"li#*iew data model. B% de!alt, when "li#*iew enconters errors dring the reload o! adocment, it atomaticall% closes the docment and reloads the last saved version o! the !ile >

    data. It can be a !rstrating e(perience when %o have 2st written a lot o! script, onl% to see alo! it lost becase %o !orgot a semicolon somewhere and didnt save the script which %o havewritten all this time. nd %o !orgot to save the script be!ore reloading the data.

    ?ne wa% to avoid this problem is b% alwa%s !irst saving %or script be!ore reloading. This canbe done b% /5 &ile @ Save Entire +ocment !rom the men, 05 trl A S, 65 lic#ing on the Saveicon in the toolbar, 75 nother more sa!e wa% is to set in "li#*iew to atomaticall% save the !ilebe!ore each reload. To do this, close the script editor and open the ser Pre!erences men b%selecting Settings @ ser Pre!erences !rom the men, or b% pressing trl A lt A . In themen, select the Save tab and tic# the chec#bo( labeled Save Be!ore $eload. It is alsoadvisable to tic# the chec#bo( se Bac#p and set the !ield Ceep :ast Instances to 9. This lastoption ensres that the last 9 versions o! the "li#*iew !ile are #ept as bac#p.

    Then-@ppl%-@o#

    www.bispsoltions.com www.bisptrainigs.com www.h%periongr.com Page 6

    http://www.bispsolutions.com/http://www.bisptrainigs.com/http://www.bispsolutions.com/http://www.bisptrainigs.com/
  • 8/13/2019 Qlikview Addressing the Data Model Issue Synthetic Key Issue

    4/19

  • 8/13/2019 Qlikview Addressing the Data Model Issue Synthetic Key Issue

    5/19

    2.2) Script pane

    This is the main wor#ing area o! the script editor. Jhen a new "li#*iew data model is created,the new script is poplated with a 8ain tab and a !ew lines where nmber interpretationvariables are added. These lines tell "li#*iew how to interpret varios nmbers and aregenerated atomaticall% based on %or operating s%stem settings.

    2.3) Tool pane

    The +ata tab gives "* the !le(ibilit% to get > connect to di!!erent data sorces to get

    data.

    The &nctions tab gives a categoried overview o! the script !nctions available in

    "li#*iew.

    The *ariables tab shows ser and s%stem variables. This tab is poplated a!ter eachreload, so in a new docment it will be blan#.

    The Settings tab contains some additional settings with regards to s%stem access andpassword scrambling.

    2.4) Script stateent

    "li#*iew script is made p o! a seKence o! :?+ > S": statements. These statements aret%picall% sed to either maniplate the data, or to conditionall% control the wa% in which the

    www.bispsoltions.com www.bisptrainigs.com www.h%periongr.com Page 9

    http://www.bispsolutions.com/http://www.bisptrainigs.com/http://www.bispsolutions.com/http://www.bisptrainigs.com/
  • 8/13/2019 Qlikview Addressing the Data Model Issue Synthetic Key Issue

    6/19

    script is e(ected. &or e(ample, we ma% want to combine two tables together, or s#ip over apart o! a script i! a condition is not met.

    Je loo# some other actions which we can per!orm throgh the "li#*iew

    Here %o can see in the script editor window the script is here !or the table ircra!t Grops and

    ircra!t T%pes I! we erase the script !rom here this will disappear the data !rom both tables in

    the sheet. :oo# here the both !ields are shown as Lnavailable5.

    3) !oading the aircraft inforation:oading o! aircra!t in!ormation sing these steps)

    Step/) hoose the !ile !or pload b% clic#ing on -@ Table !iles in the Tool Pane @ Browse the

    location o! the particlar !ile which we want to load, select Dircra!tMBaseM&ile.csv -@ ?C

    basicall% this !ile consists o! all the pdates prior to the %ear 0/. Je have loaded it in to the

    application.

    www.bispsoltions.com www.bisptrainigs.com www.h%periongr.com Page ;

    http://www.bispsolutions.com/http://www.bisptrainigs.com/http://www.bispsolutions.com/http://www.bisptrainigs.com/
  • 8/13/2019 Qlikview Addressing the Data Model Issue Synthetic Key Issue

    7/19

    Step 0) 3ow the table will be loaded in the "li#*iew

    The "* &ile Jiard has identi!ied the !ile t%pe as D+elimited, which we are loading @ &inish.

    www.bispsoltions.com www.bisptrainigs.com www.h%periongr.com Page

  • 8/13/2019 Qlikview Addressing the Data Model Issue Synthetic Key Issue

    8/19

    Step 7)

    Here the script is loaded in the table bt the name o! the !ields name are not properl%

    maintained Lso as to maintain 2oins between the tables5 so we rename the !ields b% sing Nas

    #e%word.

    Oircra!t T%pes)

    :?+ MTQPEI+ as ORircra!t T%pe I+,

    MG$?P as ORircra!t Grop T%pe,

    SS+M38E as Oircra!t 3ame,

    83&T$E$ as Oircra!t 8an!actrer,

    :?3GM38E as Oircra!t 3ame &ll,

    SH?$TM38E as Oircra!t 3ame bbreviated,

    BEGI3M+TE as Oircra!t Begin +ate,

    E3+M+TE as Oircra!t End +ate

    &$?8

    O..+ata &ilesS*sircra!tMBaseM&ile.csv

    Lt(t, codepage is /090, embedded labels, delimiter is , msK5

    Step 9) 3ow we are moving throgh or ne(t table which is Dicra!tM0/Mpdate.csv whichgives the in!ormation abot the pdates o! 0/ %ear and later.

    www.bispsoltions.com www.bisptrainigs.com www.h%periongr.com Page =

    http://www.bispsolutions.com/http://www.bisptrainigs.com/http://www.bispsolutions.com/http://www.bisptrainigs.com/
  • 8/13/2019 Qlikview Addressing the Data Model Issue Synthetic Key Issue

    9/19

    Step ;) 3ow the table will be loaded @ &inish

    Step

  • 8/13/2019 Qlikview Addressing the Data Model Issue Synthetic Key Issue

    10/19

    O..+ata &ilesS*sircra!tM0/Mpdate.csv

    Lt(t, codepage is /090, embedded labels, delimiter is , msK5

    Step =) Then the Table ircra!t Grop will be loaded in the "li#*iew application. This &ield

    contains the in!ormation abot ircra!t Grop I+ ,ircra!t Engine t%pe and ircra!t nmber o!

    Engine. &or this browse the location and open the particlar !ile.

    Step 4)3ow the data will be loaded in application-@ &inish

    www.bispsoltions.com www.bisptrainigs.com www.h%periongr.com Page /

    http://www.bispsolutions.com/http://www.bisptrainigs.com/http://www.bispsolutions.com/http://www.bisptrainigs.com/
  • 8/13/2019 Qlikview Addressing the Data Model Issue Synthetic Key Issue

    11/19

  • 8/13/2019 Qlikview Addressing the Data Model Issue Synthetic Key Issue

    12/19

    So, its ver% illogical to avoid this as it will have large no o! records. Je shold redce or data

    as mch as possible. So that we can easil% manage or data and can redce the e(tra

    statement sing Nas #e%word which can be applied in the both table. nd 2oining these 0 tables

    with this colmn > !ield name.

    we sed as ircra!t Grop Id in Rircra!t Grop T%pe these both considered as a single colmn.

    3ow loaded the data. Have a loo# at the table viewer.

    www.bispsoltions.com www.bisptrainigs.com www.h%periongr.com Page /

    http://www.bispsolutions.com/http://www.bisptrainigs.com/http://www.bispsolutions.com/http://www.bisptrainigs.com/
  • 8/13/2019 Qlikview Addressing the Data Model Issue Synthetic Key Issue

    13/19

    :oo# here the !ield Us%n/ Table which we have not import bt e(ist in the table viewer window

    This is the S%nthetic #e% which is ato-maticall% generated.

    4)S"nthetic #e" issueS%nthetic tableand S%nthetic #e%sgets created when there are more than one common !ields

    between the 0 or more tables. "li#*iew 2oin tables based on the common !ields names in the

    table and i! there is more than one common !ield then "li#*iew creates S%nthetic tables.

    S%nthetic #e%s are not bene!icial in data model becase the% are resorce intensive and ma%

    slow down calclations. The% also ma#e data model hard to nderstand. S%nthetic #e%s

    shold alwa%s be resolved.

    :oo# the three tables which we have loaded in the table having man% !ields common as we see

    ircra!tMBaseM&ile having almost !ields similar to ircar!tM0/Mpdate since in table !ield and

    these two contain one !ield similar to the table ircra!t Grop is ircra!t Grop I+.

    www.bispsoltions.com www.bisptrainigs.com www.h%periongr.com Page /

    http://www.bispsolutions.com/http://www.bisptrainigs.com/http://www.bispsolutions.com/http://www.bisptrainigs.com/
  • 8/13/2019 Qlikview Addressing the Data Model Issue Synthetic Key Issue

    14/19

  • 8/13/2019 Qlikview Addressing the Data Model Issue Synthetic Key Issue

    15/19

    3ow !ive !ields are selected those are ircra!t 3ame,ircra!t nmber o! engine,ircra!t engine

    t%pe

    ircra!t beging date,MG$?P38E.now-@ppl%-@o#.

    loo# here the data on MG$?P38E !ield disappeared de to generation o! s%nthetic #e%s

    here we have two wa%s to resolve this isse.

    sing concatenate statement

    sing 2oins

    $)Concatenate stateentThe ?3TE3TE statement is also a pre!i( to the :?+ statement, bt instead o! matchingand merging rows between tables, this statement appends the rows o! one table to anothertable.

    E(ample :oo# here we have table Table/ and Table 0

    oncatenate appends the rows o! one table to another. oncatenate never merges an% rows.The nmber o! rows in a concatenated table is alwa%s the sm o! the rows !rom the two inpttables.

    ?3TE3TE LTable/5 :?+ V $ESI+E3T Table0

    www.bispsoltions.com www.bisptrainigs.com www.h%periongr.com Page /

    http://www.bispsolutions.com/http://www.bisptrainigs.com/http://2.bp.blogspot.com/_IhQc1-zXHmU/SwXv9-873uI/AAAAAAAAAEg/0MaT2YIqUUo/s1600/ConcatenateResult.jpghttp://www.bispsolutions.com/http://www.bisptrainigs.com/
  • 8/13/2019 Qlikview Addressing the Data Model Issue Synthetic Key Issue

    16/19

    $ows are li#e Ce% vales and are notmerged together. The rows !rom Table0 are simpl%appended to Table/. Becase the tables have di!!erent !ields, rows will have nll vales !or the!ields !rom the WotherW table.

    Here we want the whole in!ormation in this the table ircra!tM0/Mpdate contain in!ormation

    o! 0/ and ircra!tMBaseM&ile in!ormation be!ore 0/ we want to per!orm

    irca!tMBaseM&ile ircra!tMBaseM&ileLprevios5A ircra!tM0/Mpdate

    we want that the data o! 0/ append to the base !ile.

    -@$eload the table-@go to the table viewer

    www.bispsoltions.com www.bisptrainigs.com www.h%periongr.com Page /

    http://www.bispsolutions.com/http://www.bisptrainigs.com/http://www.bispsolutions.com/http://www.bisptrainigs.com/
  • 8/13/2019 Qlikview Addressing the Data Model Issue Synthetic Key Issue

    17/19

    &rom the table viewer window the table ircra!tM0/Mpdate disappear and concatenates into

    the table ircra!tMBaseM&ile.

    %) &oin stateentThe '?I3 statement is a pre!i( to the :?+ statement. It is sed to 2oin the table that is beingloaded to a previosl% loaded table. The two tables are 2oined sing a natral 2oin, this meansthat the colmns in both tables are compared and the 2oin is made over those colmns that

    have the same colmn names. This means that i! mltiple colmns are shared between tables,the match will be made over the distinct combinations o! those colmns.

    E(ample we have 0 table Table/ and Table 0

    3ow the 2oin will reslt

    ?3TE3TE LTable/5 :?+ V $ESI+E3T Table0

    Here we have two tables as ircra!tMgrop and ircra!tMBaseM&ile in this we have previosl%

    seen that the data in the 0 !ields as ircra!t Grop I+ and Rircra!t Grop T%pe is same so we

    want to merge this row o! the table ircra!tMgrop

    www.bispsoltions.com www.bisptrainigs.com www.h%periongr.com Page /

    http://www.bispsolutions.com/http://www.bisptrainigs.com/http://2.bp.blogspot.com/_IhQc1-zXHmU/SwXe2Mtq1iI/AAAAAAAAAEQ/bUi0JS9Y3Oc/s1600/JoinResult.jpghttp://www.bispsolutions.com/http://www.bisptrainigs.com/
  • 8/13/2019 Qlikview Addressing the Data Model Issue Synthetic Key Issue

    18/19

    This will merge the row in the table ircra!tMbaseM&ile.

    ')Subfield (unctionSb!ield !nction are sed !or splitting the !ield via sb!ield !nction we can split two !ields

    within a single !ield.

    :oo# the !ield MG$?P38E o! ircra!t base table

    nd these two !ields o! table ircra!tMGrop

    Here the !ield MG$?P38E !rom table ircra!tMBaseM&ile covers the in!ormation o! ircra!t

    Engine T%pe and ircra!t 3mber ?& Engines o! table ircra!t Grop individall% so we can split

    these two cplomns within a single table.

    MG$?P38E ircra!t Engine T%peAircra!t 3mber ?& Engines

    This !nction is ver% case sensitive, in !ield MG$?P38E in!ormation separated b%

    commaL,5 in s%nta( as we are loading the .csv !ile which is a comma separated !ile.

    SB&IE:+LMG$?P38E,,/5 as ircra!t Engine T%pe

    SB&IE:+LMG$?P38E,,05 as ircra!t 3mber ?& Engines

    are nmbered as / and 0 to identi!% the !ields which are going to get split.

    www.bispsoltions.com www.bisptrainigs.com www.h%periongr.com Page /

    http://www.bispsolutions.com/http://www.bisptrainigs.com/http://www.bispsolutions.com/http://www.bisptrainigs.com/
  • 8/13/2019 Qlikview Addressing the Data Model Issue Synthetic Key Issue

    19/19

    3ow reload the table and go to the table viewer window. :oo# here the s%nthetic #e% resolved

    and data managed in !ormatted wa%.

    www.bispsoltions.com www.bisptrainigs.com www.h%periongr.com Page /

    http://www.bispsolutions.com/http://www.bisptrainigs.com/http://www.bispsolutions.com/http://www.bisptrainigs.com/

Recommended