Skip to Content
Jul 27, 2017 at 03:34 AM

Option to implement LOOKUP( ) Functionality in HANA Calculation View


Hi All,

I had this requirement to lookup a value from one table to another containing only ranges of value. The approach was to use a graphical calculation view but I can't seem to make it work because it has to have a join between table A and B.

To put a bit of clarity, say we have Table A - TBL_PRINCIPAL_MASTER and Table B - TBL_PRINCIPAL_RANGE with the following values

Should be result set:

Apparently, I can't do left outer join because it doesn't have a common value between the two table from which I could bind the result set. The thing which may tie the two can only be determined through conditional operator other than equal to(=)i.e. IF TBL_PRINCIPAL_MASTER.CODE IS BETWEEN TBL_PRINCIPAL_RANGE.FROM AND TBL_PRINCIPAL_RANGE.TO.Or CODE>=FROM AND CODE<=TO.

Now I am trying to work it out using SQL Calculation View/Procedure/Function, whichever serves the purpose. What I will do is populate TBL_PRINCIPAL_MASTER as my base table and iterate through it, get the CODE and pass it down to TBL_PRINCIPAL_RANGE as parameter.

Any advice will be much appreciated.


Rod Castro

P.s. From BO Data Services perspective, this is definitely attainable.


source.png (4.6 kB)
target.png (2.2 kB)