Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
virilo_tejedor
New Contributor III

text to number hash in chart expression

Hi,

I've seen that autonumberhash128 and similar functions are available only in the load script

I've unrelated fields containing similar values, let say "Client Name" ={'Anna', 'John', 'Mary'} and "Seller Name" ={'Anna', 'Mary', 'Paul'}

And I'd like to respresent them, using the same consistent colors throughout the application.

I thought I could have in Load Script:

 set vBGColors_qlik12=#332288,#6699cc,#88ccee,#44aa99,#117733,#999933,#ddcc77,#661100,#cc6677,#aa4466,#882255,#aa4499;
 set vNumColors_qlik12='=SubStringCount(vBGColors_qlik12, '','')+1';

And use the next chart expression for the color:

 =Subfield (vBGColors_qlik12, ',', mod(autonumberhash128 (CLIENT_NAME),vNumColors_qlik12))

But autonumberhash128 is not available for expressions in charts

How could I get a consistent string to number hash functiont in chart expressions?
Is there another way to have it working?


I thought about calculating it during the loading script. But I have the feeling that it is not a good idea to combine data with representation; and unnecessarily increase the amount of data loaded in memory:

  ...

 NAME as CLIENT_NAME,
 autonumberhash128(NAME) as CLIENT_COLOR

 ...

Thanks in advance.

Cheers

3 Replies
Partner
Partner

Re: text to number hash in chart expression

Hi Virilo,

For 'using the same consistent colors throughout the application' you can use master dimensions. When you created one for your dimensions, click on them again and then you can use color scheme for each value.

Jordy

Climber

Work smarter, not harder
virilo_tejedor
New Contributor III

Re: text to number hash in chart expression

Hi Jordy,

Thanks for your response @JordyWegman !

I've watched https://www.youtube.com/watch?v=5eucibmotOo

I'm going to give it a try.

But, I'm not sure if it's going to work in my case, since I have two master dimensions, with 80% of similar values, and I'd like both to use the same colors

BR,

Virilo

Re: text to number hash in chart expression

Look here for a way to store this information in a table

Colors in charts & Maintaining Color of the Dimensions

Also, I have not read this through, but for Qlik Sense, you can probably look here also

Dimension Colors