Skip to Content
0
Dec 15, 2015 at 04:45 AM

Can we pass a columns dynamically in the select statement of Calculation view.

964 Views

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.