cancel
Showing results for 
Search instead for 
Did you mean: 

HOW TO USE UNION WITH CONSTANT VALUES IN SCRIPTED VIEW

former_member224444
Participant
0 Kudos

Hi All,

I am doing a work out on Union operator. When using Union in calculation view by default it will work as union with constant values. but same is not possible in Scripted view.

For Eg: Table1

Table2

Below is the output of calculation view which i used union node:

Output:

Same output i get using below query in scripted view

SELECT REGION_ID,PRODUCT_ID,SUM(SALES_AMOUNT),SUM(DISCOUNT) FROM(

SELECT REGION_ID,PRODUCT_ID,SALES_AMOUNT,0 AS DISCOUNT FROM "NEO_B45RWNY007IMPIDRM4ZSG1OV0"."SALES"

UNION ALL

SELECT * from "NEO_B45RWNY007IMPIDRM4ZSG1OV0"."SALES1") GROUP BY REGION_ID,PRODUCT_ID;

Is there any other syntax like union with constant values in sql hana

Thanks,

Rithika

Accepted Solutions (0)

Answers (2)

Answers (2)

anindya_bose
Active Contributor
0 Kudos

If you want to use only SQL statements i.e No CE Function

, below one works for me.

SALES1:

SALES2:

Result in all 3 models ( graphical CV, Scripted CV with CE_FUNCTION, Scripted CV with SQL )

Cheers

Anindya

anindya_bose
Active Contributor
0 Kudos

Hi Rithika

Below Script works for me . Here I used CE function to achieve the same.

As long as in your data set characteristics are same in both the tables, it should work for you also

Last statement can also be changed to use CE function only.

var_out = CE_UNION_ALL(:P11 ,:P22 ) ;

Cheers

Anindya