How to - Dynamic Look and Feel


    How to - Dynamic Look and Feel

     

     

     

    The concept here is to have colors and logo dynamically changed based on a listbox.

     

     

     

     

    Steps:

     

    1)

    Download attached package and saved included picture to a folder.

     

    2)

    Create new application and copy and paste below code:

     

    Company:

    load * inline [

    PickName,Company,val

    pepsilogo.jpg,Pepsi,1

    cokelogo.jpg,Coke,2

    catlogo.jpg,Cat,3

    ]

    ;

    Colors:

    load * inline [

    No.,      Pepsi,    Coke,Cat,Variable Name,Info

    1, 'RGB(232,17,45)','RGB(184,19,33)','RGB(0,0,0)',vTabActiveBg,Active Backround

    2, 'RGB(0, 133, 202)','RGB(51,11,12)','RGB(255,223,0)',vTabInactiveBg,Incative Background

    ]

    ;

     

    T1:

    load  * inline [

    Product,Value,Country

    A,1,Russia

    B,2,UK

    C,3,Poland

    D,4,Germany

    E,5,Czech

    ]

    ;

    pics:

    bundle load * Inline

    [

    PickName,Path

    pepsilogo.jpg,'D:\Multilanguages\pepsilogo.jpg'

    cokelogo.jpg,'D:\Multilanguages\cokelogo.jpg'

    catlogo.jpg,'D:\Multilanguages\catlogo.jpg'

    ]

     

    3)

    Change this part

    'D:\Multilanguages\catlogo.jpg'


    to  a path with a folder with your pictures.

     

    Reload.

     

    4)

    Create:

    a) List box -  with field "Company"

    b) Bar chart -- with "Product" as Dimension

                            and SUM(Values) as Expression


    c) Text box-

    with Representation as "Image"

    and below expression in Text box:

    =if(Company=Company,Info(PickName),'NA')

    Capture.PNG

     

    5)

    Add 3 variables:

    Capture.PNG

    a) vTabActiveBg

          =$(=fieldvalue($(vCompany),1))

     

    b) vTabInativeBg

      =$(=fieldvalue($(vCompany),2))

     

    c) vCompany

          =Chr(39)&Company&Chr(39)



    6)

    In the Caption section of an object change the Base Color of " Active " and "Inactive Colors" to

    "Calculated" with an expression

     

    for "Inactive Caption" use:

    =vTabInactiveBg


    For "Active Caption"

    =vTabActiveBg

    Capture.PNG


    The final picture will be similar to this one


    Capture.PNG

     

    Now you can use  the list box to change the colors and the logo of the company.

    As you probably realize at this point, you can add  more variables to have every other color dynamically change this way.

     

    Feeling Qlikngry?

    How To /Missing Manual(23 articles)