Skip to Content
0
Former Member
Jan 21, 2015 at 05:20 AM

Calculating average using CE functions

33 Views

Hi ,

I am trying to calculate the average using the CE function. My code is as follows

CREATE PROCEDURE VBI_FINAL_LIST (OUT VAR_OUT VBI_RESULT_DUMMY)

LANGUAGE SQLSCRIPT

READS SQL DATA AS

BEGIN

OUT_ROUND6 = CE_COLUMN_TABLE("MONISSHAA"."VBI_INTERVIEWEE_TEST_DETAILS");

OUT_FINAL_CANDIDATE_LIST = CE_PROJECTION(:OUT_ROUND6, [ID, ROUND_ID], '"ROUND_ID" = ''R6''');

OUT_SCORE_DETAILS = CE_PROJECTION(:OUT_ROUND6,[ID, SCORE]);

OUT_SCORE_SUMMARY = CE_JOIN (:OUT_ROUND6, :OUT_FINAL_CANDIDATE_LIST,[ID], [ID, SCORE]);

VAR_OUT_2 = CE_AGGREGATION (:OUT_SCORE_SUMMARY, [ SUM("SCORE") AS TOTAL_SCORE, COUNT("SCORE") AS COUNT_SCORE], [ID]);

VAR_OUT = CE_PROJECTION(:VAR_OUT_2, [ID, CE_CALC('TOTAL_SCORE/COUNT_SCORE' , INTEGER) AS SCORE ]);

END

When I call the procedure, I get the following error

error: [34011] failed to save calculation scenario : The following errors occured: Inconsistent calculation model (34011)

Details (Errors):

- CalculationNode ($$VAR_OUT$$) -> attributes -> calculatedAttribute (SCORE) -> expression: Attribute 'count_score' is missing in node $$VAR_OUT$$.

- CalculationNode ($$VAR_OUT$$) -> attributes -> calculatedAttribute (SCORE) -> expression: Attribute 'total_score' is missing in node $$VAR_OUT$$.

Kindly some one help me to resolve this

Regards,

Monissha