3 Replies Latest reply: Sep 28, 2013 1:29 PM by Car Bal RSS

    Color Function

    Manish Kachhia

      I found below code from of the Community Question...

      http://community.qlik.com/message/359002#359002

       

      Can someone explain how below function work?

       

      =if(GetSelectedCount(Product) and SubStringCount(Concat(distinct Product),Product),color(FieldIndex('Product',Product)))

        • Re: Color Function
          jagan mohan rao appala

          Hi Manish,

           

          =if(GetSelectedCount(Product) and SubStringCount(Concat(distinct Product),Product),color(FieldIndex('Product',Product)))



          GetSelectedCount(Product) - Checks whether any product is selected in listbox

          Concat(Distinct Product) - Concats all the selected values in Product listbox


          SubStringCount(Concat(Distinct Product, Product) - Checks whether the product is exists in the concatenated string (output of Concat())


          FieldIndex('Product',Product) - Will give the index number of the Product in the Product dimension

          Color(FieldIndex('Product',Product)) - Will give the color code (RGB()) for the index number of the product value.

           

          Finally, this expression is used to assign the Color to the Product in chart.

           

          Hope this helps you.

           

          Regards,

          jagan.