Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
virilo_tejedor
Creator
Creator

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

Labels (4)
3 Replies
JordyWegman
Partner - Master
Partner - Master

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
Creator
Creator
Author

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

sunny_talwar

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