Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Usage of AutonumberHas256()

Hi Folks

I'm wondering if somebody can help me out here on the usage of AutoNumberHash256 to covert a big concatenated couple of numbers into a key value.  I'm ok with the function itself, but it appears that the results of the function are per QVW document or session.

EG:

I have a mapping table of ID's where I need to create a cartesian product of the table and then create KEY values for each entry, I do this in a QVW Document on its own and it appears to work in that it generates the table.

I then have my end user document which has one table before the mapping and on table after the mapping. I'm using the same AutoNumberHash256() function here but the results of the key values are different.

So, in QVW Document 1 as an example I have

Field1     Field2     AutoNumberKey

1               A               45

2               B               17

3               c               6

However, when I use the same values, in a different table, in a different QVW the results could be

Field1     Field2     AutoNumberKey

1               A               142

2               B               3

3               c               99

I am wondering if the function is therefore session dependent, the key values returned are unique in both cases, but I was expecting AutoNumberHash256(1,A) to ALWAYS produce the same result. This doesn't appear to be the case.

Anybody have any thoughts on this.

Cheers,

Nigel.

2 Replies
Gysbert_Wassenaar

but I was expecting AutoNumberHash256(1,A) to ALWAYS produce the same result. This doesn't appear to be the case.

That's correct. The same inputs yield the same result only in the same reload. If you want persisting values you need to use the hashXXX functions. Those return strings however, not numbers.


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

Nigel,

as we could learn from Henric (http://community.qlik.com/blogs/qlikviewdesignblog/2012/11/20/symbol-tables-and-bit-stuffed-pointers) the integer values of autonumbering your key combinations are implicitely calculated from the symbol tables.

So, different symbol tables will result in different autonumber values. In your given example, you will only get the same numbering if your Hash Keys in one qvw are a subset of the hash keys in the second qvw, and load order is the same.

[edited: I think that's not fully correct, when I think of having a subset with missing values inbetween or at the beginning...]

I remember another discussion here that introduced a method for your issue (same autonumber across multiple qvw) by exchanging information via a qvd, but couldn't find the thread right now.

Regards,

Stefan