Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
IAMDV
Luminary Alumni
Luminary Alumni

*** Need help in understand the expression *** (Hash128 with Concat)

Dear All,

Please can someone explain the below expression. This is generic expression by using the Hash128 & Concat Functions. I am very interested to learn these functions.

This function is written by Alistair Eaves

=$(='if('&concat('NOT IsNull(['&$Field&'])',' AND ')&', hash128('& concat('['&$Field&']',',')&'))' )

Many thanks in advance.

Cheers!

1 Solution

Accepted Solutions
brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi, DV,

it is not so difficult, it means to set in a variable a combination of the fieldcontent from $Field, if not null and the function hash128($Field), something like this:

=$(=If(Not IsNull($Field),' AND ', Hash128($Field)))

View solution in original post

10 Replies
IAMDV
Luminary Alumni
Luminary Alumni
Author

Please can someone help on this?

Many thanks in advance.

IAMDV
Luminary Alumni
Luminary Alumni
Author

Folks - Please can someone help me on this one?

Cheers!

brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi, DV,

it is not so difficult, it means to set in a variable a combination of the fieldcontent from $Field, if not null and the function hash128($Field), something like this:

=$(=If(Not IsNull($Field),' AND ', Hash128($Field)))

IAMDV
Luminary Alumni
Luminary Alumni
Author

Martina - Thank you very much for replying back. Yeah! It makes sense now. However, please can you explain Hash128($Field)? I had referred the documentation but I could not comprehend the explanation...

Thank you in advance.

ToniKautto
Employee
Employee

Not really sure what answer you are looking for here, as the functions are quite well described in the manual. What makes this specific piece of expression look a bit nasty is that the the dollar expansion input is a string.

Basically what happens here is that the first Concat() produces a AND eprataed string, which then becomes the IF statement's condition. Followingly the hash128() result then becomes the output of the if statement if the condition is true. In both Concat()'s the string is based on an iteration over $Field.

=if( concat(not IsNull($Field),'AND') ,
hash128( concat($Field,',') )
)



concat([{set_expression}] [ distinct ] [ total [<fld {, fld}>]] expression[, delimiter[, sort_weight]])

Returns the aggregated string concatenation of all values of expression iterated over the chart dimension(s). Each value may be separated by the string found in delimiter. The order of concatenation may be determined by sort-weight. Sort-weight should return a numeric value where the lowest value will render the item to be sorted first.

hash128( expression {, expression} )

Returns a 128-bit hash of the combined input expression values. The result is a string.

ToniKautto
Employee
Employee

Just to clarify a bit further.

The concats expand into string so the actual if statement looks something like;

=if( not IsNull(FieldValue1 AND not IsNull(FieldValue2 AND /.../ AND not IsNull(FieldValueN) ,
hash128(FieldValue1,FieldValue2,/.../,FieldValueN)
)

Atleast if I got all the &-signs properly removed...

IAMDV
Luminary Alumni
Luminary Alumni
Author

Thank you Toni.

Can we use the expression without using the Hash128 function? I am not clear on Hash128 function. Please bear with my ignorance 🙂

Thanks!

ToniKautto
Employee
Employee

The hash128() simply outputs a 128bit string based on the input values, which you will see as a 16 character string (16*8=128).

Whether you choose to use Hash or not is up to your purposes, but if you are looking for a 16 characters scrambled string then this is likely suitable.

IAMDV
Luminary Alumni
Luminary Alumni
Author

Hi Toni & Martina,

I know this is old post but can one of you help me to get rid of Hash128() from the expression? I had tried to do this but it gives error. Please can someone help on this?

=$(='if('&concat('NOT IsNull(['&$Field&'])',' AND ')&', hash128('& concat('['&$Field&']',',')&'))' )

Many thanks in advance!

Cheers - DV