<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Convert strings into RGB in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Convert-strings-into-RGB/m-p/1280027#M401510</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Exactly - at the end we're displaying always the same points on a map but the different classifications of the elements should be seenable with a different color. The classification is in different dimensions...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Guess I found an easy solution:&lt;/P&gt;&lt;P&gt;hsl(&lt;/P&gt;&lt;P&gt;&amp;nbsp; (&lt;/P&gt;&lt;P&gt;&amp;nbsp; mod((ord(mid(Hash128(Dim1),3,1)) + (((ord(mid(Hash128(Dim1),2,1)) + (((ord(mid(trim(Hash128(Dim1)),len(trim(Hash128(Dim1)))-1,1)) + ((0 &amp;lt;&amp;lt; 5) - 0)) &amp;lt;&amp;lt; 5) - (ord(mid(trim(Hash128(Dim1)),len(trim(Hash128(Dim1)))-1,1)) + ((0 &amp;lt;&amp;lt; 5) - 0)))) &amp;lt;&amp;lt; 5) - (ord(mid(Hash128(Dim1),2,1)) + (((ord(mid(trim(Hash128(Dim1)),len(trim(Hash128(Dim1)))-1,1)) + ((0 &amp;lt;&amp;lt; 5) - 0)) &amp;lt;&amp;lt; 5) - (ord(mid(trim(Hash128(Dim1)),len(trim(Hash128(Dim1)))-1,1)) + ((0 &amp;lt;&amp;lt; 5) - 0)))))),100)&lt;/P&gt;&lt;P&gt; ) /100&lt;/P&gt;&lt;P&gt;,&lt;/P&gt;&lt;P&gt;mod(ord(mid(Hash128(Dim1),5,1)),10)/10,mod(ord(mid(Hash128(Dim1),8,1)),10)/10)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where Dim1 is replacable by the $(TableSelection).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Marcus / Stefan: This means I have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a) always the same color for the different elements&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;b) I need to create a color mapping first with looping trough the elements&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 20 Nov 2016 15:24:26 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-11-20T15:24:26Z</dc:date>
    <item>
      <title>Convert strings into RGB</title>
      <link>https://community.qlik.com/t5/QlikView/Convert-strings-into-RGB/m-p/1280023#M401506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Need some help on a tricky problem &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically we have a bar chart which is dynamically when it comes to the dimension:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DimensionFilterTable:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TableSelection, DimDisplayName&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dim1, Country&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dim2, Ciy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dim3, Seller&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 10pt;"&gt;];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the table we're working with a calculated dimension:&lt;/P&gt;&lt;P&gt;=$(=TableSelection)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So far it works perfect. But now I want to use different colors for the different dimension elements - the normal approach doing this in the loading script is not really useful because this &lt;SPAN style="font-size: 13.3333px;"&gt;DimensionFilterTable is flexible. My idea was now to somehow generate RGB depending on the string:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="160"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" width="80"&gt;Element&lt;/TD&gt;&lt;TD width="80"&gt;Color&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;Exa1&lt;/TD&gt;&lt;TD&gt;red()&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;Exb2&lt;/TD&gt;&lt;TD&gt;green()&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;sdf&lt;/TD&gt;&lt;TD&gt;black()&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;Exa1&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;red()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Any idea? No script code should be used because it would mean to specify all the times the flexible dimensions and its elements with color codes. Something like this...but qlikish &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;A href="http://stackoverflow.com/questions/11120840/hash-string-into-rgb-color" title="http://stackoverflow.com/questions/11120840/hash-string-into-rgb-color"&gt;Hash string into RGB color - Stack Overflow&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Nov 2016 20:40:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Convert-strings-into-RGB/m-p/1280023#M401506</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-19T20:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: Convert strings into RGB</title>
      <link>https://community.qlik.com/t5/QlikView/Convert-strings-into-RGB/m-p/1280024#M401507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Which color should be assigned to which dimension value? Is there a logic or do you simply want a random color assigned, any color will do as long as it is a color and each dimension value gets its own unique color?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Nov 2016 11:58:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Convert-strings-into-RGB/m-p/1280024#M401507</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-11-20T11:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: Convert strings into RGB</title>
      <link>https://community.qlik.com/t5/QlikView/Convert-strings-into-RGB/m-p/1280025#M401508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe this is helpful: &lt;A href="https://community.qlik.com/qlik-blogpost/2831"&gt;Colors in charts&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Nov 2016 12:22:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Convert-strings-into-RGB/m-p/1280025#M401508</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2016-11-20T12:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: Convert strings into RGB</title>
      <link>https://community.qlik.com/t5/QlikView/Convert-strings-into-RGB/m-p/1280026#M401509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt; the normal approach doing this in the loading script is not really useful because this &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;DimensionFilterTable is flexible"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if this is your primary concern, you should be able to direct QV to the correct color code field (e,g. following Henric's blog post Marcus referenced) based on the dimension used with a similar approach you are using for the dimension:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;DimensionFilterTable:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;LOAD * INLINE [&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TableSelection, DimDisplayName&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; , DimColorCodeField&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dim1, Country, CountryColor&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dim2, Ciy, CityColor&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dim3, Seller, SellerColor&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;];&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;=$(=Only(DimColorCodeField))&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Nov 2016 13:46:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Convert-strings-into-RGB/m-p/1280026#M401509</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-11-20T13:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: Convert strings into RGB</title>
      <link>https://community.qlik.com/t5/QlikView/Convert-strings-into-RGB/m-p/1280027#M401510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Exactly - at the end we're displaying always the same points on a map but the different classifications of the elements should be seenable with a different color. The classification is in different dimensions...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Guess I found an easy solution:&lt;/P&gt;&lt;P&gt;hsl(&lt;/P&gt;&lt;P&gt;&amp;nbsp; (&lt;/P&gt;&lt;P&gt;&amp;nbsp; mod((ord(mid(Hash128(Dim1),3,1)) + (((ord(mid(Hash128(Dim1),2,1)) + (((ord(mid(trim(Hash128(Dim1)),len(trim(Hash128(Dim1)))-1,1)) + ((0 &amp;lt;&amp;lt; 5) - 0)) &amp;lt;&amp;lt; 5) - (ord(mid(trim(Hash128(Dim1)),len(trim(Hash128(Dim1)))-1,1)) + ((0 &amp;lt;&amp;lt; 5) - 0)))) &amp;lt;&amp;lt; 5) - (ord(mid(Hash128(Dim1),2,1)) + (((ord(mid(trim(Hash128(Dim1)),len(trim(Hash128(Dim1)))-1,1)) + ((0 &amp;lt;&amp;lt; 5) - 0)) &amp;lt;&amp;lt; 5) - (ord(mid(trim(Hash128(Dim1)),len(trim(Hash128(Dim1)))-1,1)) + ((0 &amp;lt;&amp;lt; 5) - 0)))))),100)&lt;/P&gt;&lt;P&gt; ) /100&lt;/P&gt;&lt;P&gt;,&lt;/P&gt;&lt;P&gt;mod(ord(mid(Hash128(Dim1),5,1)),10)/10,mod(ord(mid(Hash128(Dim1),8,1)),10)/10)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where Dim1 is replacable by the $(TableSelection).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Marcus / Stefan: This means I have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a) always the same color for the different elements&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;b) I need to create a color mapping first with looping trough the elements&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Nov 2016 15:24:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Convert-strings-into-RGB/m-p/1280027#M401510</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-20T15:24:26Z</dc:date>
    </item>
    <item>
      <title>Re: Convert strings into RGB</title>
      <link>https://community.qlik.com/t5/QlikView/Convert-strings-into-RGB/m-p/1280028#M401511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2016-11-20 16_25_13-QlikView x64 Personal Edition - [E__4_Temp_qlik_dsfsdf.qvw_].png" class="jive-image image-1" src="/legacyfs/online/144347_2016-11-20 16_25_13-QlikView x64 Personal Edition - [E__4_Temp_qlik_dsfsdf.qvw_].png" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Nov 2016 15:27:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Convert-strings-into-RGB/m-p/1280028#M401511</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-20T15:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: Convert strings into RGB</title>
      <link>https://community.qlik.com/t5/QlikView/Convert-strings-into-RGB/m-p/1280029#M401512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Uhm, wow. I hope you didn't spend much time on putting that monster together.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps this will work too:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hsl(&lt;/P&gt;&lt;P&gt;&amp;nbsp; FieldIndex('&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;$(TableSelection)&lt;/SPAN&gt;',[$(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;TableSelection&lt;/SPAN&gt;)])/FieldValueCount('&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;$(TableSelection)&lt;/SPAN&gt;'),&lt;/P&gt;&lt;P&gt;&amp;nbsp; 0.5,&lt;/P&gt;&lt;P&gt;&amp;nbsp; 0.5&lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But imho a better idea is to load a table with colors like this one: &lt;A href="https://en.wikipedia.org/wiki/List_of_Crayola_crayon_colors#Standard_colors" title="https://en.wikipedia.org/wiki/List_of_Crayola_crayon_colors#Standard_colors"&gt;List of Crayola crayon colors - Wikipedia&lt;/A&gt;‌. You could use the index value of the dimension to pick the color from the color table with the same index value.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Nov 2016 17:26:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Convert-strings-into-RGB/m-p/1280029#M401512</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-11-20T17:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: Convert strings into RGB</title>
      <link>https://community.qlik.com/t5/QlikView/Convert-strings-into-RGB/m-p/1280030#M401513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok wow - that's a lot smarter &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/grin.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, works like a charm.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Nov 2016 17:44:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Convert-strings-into-RGB/m-p/1280030#M401513</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-20T17:44:57Z</dc:date>
    </item>
  </channel>
</rss>

