on 03-24-2013 10:33 PM
Hi,
Here's the script.
SQLA_VIEW= CE_OLAP_VIEW
("_SYS_BIC"."e2sc-hana/AV_ORDERS_PROM",
[
"SUPPLIER_NAME","ITEM_NAME","ITEM_DESCRIPTION","CUST_SITE_NAME",
"PO_NUMBER", "PO_CREATION_DATE", "UNIT_PRICE", "PO_LINE_ITEM_ID",
AVG("CYCLE_TIME") AS "AVG_CYCLE_TIME"
]
);
var_out = CE_PROJECTION(:SQLA_VIEW, ["ITEM_NAME","AVG_CYCLE_TIME"]);
Basic I have a calculated column defined called CYCLE_TIME in the Analytic view (AV_ORDERS_PROM) that does this: daysbetween("PO_CREATION_DATE","DATETIMESTAMP")
Once this is computed at an order/line/schedule level, I want to compute the average in the calc view.
I tried SUM("CYCLE_TIME") / COUNT("CYCLE_TIME") and somehow the / operator was not liked by the engine.
Then I tried AVG function as above and it throws the following error:
Repository: Activation failed for at least one object;At least one runtime reported an error during activation. Please see CheckResults for details
Hi Sudarshan,
Please try the following:
CE_CALC('"SUM_CYCLE_TIME" / "CNT_CYCLE_TIME"', INTEGER) AS "AVG_CYCLE_TIME"
I tried the above and it works for me.
Regards,
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi,
Thanks for the response, here's my script. In output parameters I have defined all 4
AVG_CYCLE_TIME,ITEM_NAME,CNT_CYCLE_TIME,SUM_CYCLE_TIME.Tried several other combinations...
/********* Begin Procedure Script ************/
BEGIN
SQLA_VIEW = CE_OLAP_VIEW
("_SYS_BIC"."e2sc-hana/AV_ORDERS_PROM", ["CYCLE_TIME","ITEM_NAME"]);
SQLB_VIEW = CE_AGGREGATION
(:SQLA_VIEW,
[SUM("CYCLE_TIME") AS "SUM_CYCLE_TIME", COUNT("CYCLE_TIME") AS "CNT_CYCLE_TIME"], ["ITEM_NAME"]
);
var_out= CE_PROJECTION
(:SQLB_VIEW,
["SUM_CYCLE_TIME","CNT_CYCLE_TIME",
CE_CALC('"SUM_CYCLE_TIME" / "CNT_CYCLE_TIME"', INTEGER) AS "AVG_CYCLE_TIME","ITEM_NAME"]);
END
/********* End Procedure Script ************/
This throws the following error
Hi Ravi,
Ignore the above, the above error went way after I defined the output parameters in the same sequence as my var_out. However here's the issue we saw earlier this week. Notice from the screenshot avg is showing as sum and also the count is 1 instead of 3. Expected average across the 3 records for this particular item should be 11.333 isnt it?
Thanks,
Sudarshan.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.