on 12-15-2015 4:45 AM
I am looking for an approach where I need to pass the table columns dynamically.
I have a table with below structure.
Table name: TABLE_COLUMNS
USERID | COLUMNA | COLUMNB | COLUMNC|
---------------------------------------------------------------------
A | 10 | 20 | 30
B | 11 | 21 | 31
C | 12 | 22 | 32
I have a CV created with an input parameter which accepts a 'column' from above table. Based on the input parameter recieved, I need to display the values of the column.
Eg: If the input parameter recieves 'COLUMNA' as input, then I need to display the values from COLUMNA.
Can any one help me with the query which I need to script in the Calculation view. Normally in SQL console, I can write as
SELECT DISTINCT COLUMNA FROM TABLE_COLUMNS.
But this doesn't work in the Calculation view. Can anyone post the query I can use or an approach I can use.
If the input parameter recieves 'COLUMNA' as input, then I need to display the values from COLUMNA.
why you dont use dynamic sql ? You can send column names dynamically
EXEC 'SELECT' ||:colname|| 'from CALC_VIEW'.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Venkat,
are you using a graphical calculation view? In case you do and in case the type of your "dynamic" columns is the same, you can create a calculated column which uses the "case" function (Miscellaneous Functions - SAP HANA Modeling Guide - SAP Library).
e.g. CASE("$$IP_COL_NAME$$", 'COLUMNA', "COLUMNA", 'COLUMNB', "COLUMNB", 'COLUMNC', "COLUMNC")
Regards,
Florian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.