Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
MK_QSL
MVP
MVP

Color Function

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)))

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

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.




View solution in original post

3 Replies
jagan
Luminary Alumni
Luminary Alumni

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.




MK_QSL
MVP
MVP
Author

Thanks Jagan

Anonymous
Not applicable

Great explanation !

I wish manuals written this way. But it's just a dream.

Thanks.