Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
FrankTheTank
Contributor III
Contributor III

AutoNumberHash256

Hello dear community,

I have a table 'vTable'. With a number of x columns. I do not know the exact number and not the column names. Now I would like to calculate a hash value over all columns (per line).

I can calculate the number of columns with

 

Num(NoOfRows('$(vTable)'),'#.##0,#')			as TableRows,

and name with

 

 

FOR i = 1 to NoOfFields('$(vTable)')
Fields:
LOAD
FieldName($(i),'$(vTable)')	AS FieldName
AutoGenerate 1
;

NEXT i

how do I now get the function 'Autonumberhash256 ()' fed so that I get the desired hash value?

 

Thanks in advance and have a nice day 😄

1 Solution

Accepted Solutions
tresesco
MVP
MVP

You could probably create a variable to concatenate all the field names as a string and then use that in autonumberhash256(), like:

Let vFieldsConcatenated=;

FOR i = 1 to NoOfFields('tTable')
Fields:
LOAD
FieldName($(i),'tTable')	AS FieldName
AutoGenerate 1
;
Let vFieldsConcatenated='$(vFieldsConcatenated)'&If($(i)>1,',')&Peek('FieldName');
NEXT i

RegionSales:
LOAD *,
AutoNumberHash256($(vFieldsConcatenated)) as HashMkey
Resident tTable;

View solution in original post

4 Replies
marcus_sommer

It's not quite clear for me what do you want to do. Do you want to apply the hash-logic for the columns within the table or for the records? What is the aim behind it?

- Marcus

FrankTheTank
Contributor III
Contributor III
Author

I want to use the hash logic for every row within the table.

so that i can compare the row with her predecessor.

 

Example:

Row_1: A, B, C, Hash=100 

Row_2: A, D, C, Hash=105  -> i get the information that in this row is a change.

tresesco
MVP
MVP

You could probably create a variable to concatenate all the field names as a string and then use that in autonumberhash256(), like:

Let vFieldsConcatenated=;

FOR i = 1 to NoOfFields('tTable')
Fields:
LOAD
FieldName($(i),'tTable')	AS FieldName
AutoGenerate 1
;
Let vFieldsConcatenated='$(vFieldsConcatenated)'&If($(i)>1,',')&Peek('FieldName');
NEXT i

RegionSales:
LOAD *,
AutoNumberHash256($(vFieldsConcatenated)) as HashMkey
Resident tTable;
FrankTheTank
Contributor III
Contributor III
Author

thanks, that is excactly what iam looking for.

VG