cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a Hash function in a Calculated Column

0 Kudos

Team:

Currently we are following this process:

1. Create Cal View. Here, we consolidate three data sources.

2. Create TUDF using the above fields. Here we need to apply HASH_SHA256 function. WE cannot invert the process.

3 Create final Cal View using the the above objects.

My question to you all is this: how can I implement the above HASH function in a calculated column? if this is possible, we will save some time in the project.

I will be happy for any idea.

Regards

RAP

0 Kudos

lbreddemann

We use SCP SAP HANA Service Neo revision 1.00.122.29. I work with SAP HANA web-based workbench development, as well as with HANA studio 2.3.13.

The error message you see below. It is already thrown, when you validate the syntax for the calc column.

I would say, as this function is not provided in the list of available functions you cannot use this. That's the reason why I'm interested in your solution.

BR Andreas

lbreddemann
Active Contributor
0 Kudos

The list of available functions in the HANA Studio modeler is not linked to what's supported as functions in SQL expressions - at least I'm not aware that there is an effort being made to keep those two in sync (especially since HANA Studio has not been developed further for years).

Concerning the error message: I'd say this is related to the HANA release. With HANA 1 the language "SQL" options in calc. view expressions are limited in that not all SQL functions are supported, as you've found.

The option I explained works on the current HANA 2 release and there's no "special flag" or so in the expression editor that you could see in a screenshot.

0 Kudos

In the meanwhile I tested on a different HANA DB (v 2.0) and everything works as expected. So it seems to be related to the used HANA version.

Thanks for your help.

Accepted Solutions (1)

Accepted Solutions (1)

lbreddemann
Active Contributor

Team? This is a user community - not your "team"...

Anyhow, Paul, why this complicated approach?

Why not just create a calculated column with "Language" set to "SQL" and place the function call to HASH_SHA256 in there?

That worked just fine on my HANA HXE instance.

0 Kudos

Lars: In the English speaking world, we use the term "Team" to be inclusive to indicate. I am part of. Secondly, my name is RAUL similarly to RALF. Great answer to my question, vielen dank.

0 Kudos

Hi Lars,
can you maybe provide a screenshot of your working solution, the calc column with the expression? We have exactly the same requirement and I did some tests with the approach you described, but the validation always failed.

Thanks and regards

Andreas

lbreddemann
Active Contributor
0 Kudos

andreas.walter1 what versions of HANA and HANA Studio/dev tools are you using?

I used the current HANA express edition (sps 4).

Also, what exact error did you get? It might be better if you put all that into a new question.

0 Kudos

sorry for adding my last comment in the wrong part of the conversation

Answers (1)

Answers (1)

0 Kudos

Andrea:

In our case, the function is accepted with no issues. In addition, In fact, we tested in a calculation view and we set the language to SQL as suggested by Lars. It worked as well.