"Identifier out of scope: " error when query against an event stream which aggregates one of the event properties.

"Identifier out of scope: " error when query against an event stream which aggregates one of the event properties.

book

Article ID: KB0084736

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition -
Not Applicable -

Description

Resolution:
Description:
============

Using one field  the average the query works.
eg:

select well.W_GNR_NAME,  avg(well.OIL_RT_FM)  from /Events/EPAT/EPAD/EPAD_RLTM_VLDT_DAY_TIBCO_RSLT well group by well.W_GNR_NAME

However, two fields returned the error of "Identifier out of scope: ".
eg select well.W_GNR_NAME, well.T_YR,  avg(well.OIL_RT_FM)  from /Events/EPAT/EPAD/EPAD_RLTM_VLDT_DAY_TIBCO_RSLT well group by well.W_GNR_NAME




Environment:
==========

Symptoms:
=========
Stack trace:
Stack trace:
2011 Jun 27 15:22:59:050 GMT +3 DLAMONTMX103734.aramco.com Info [main] - [user] [query-class] java.lang.RuntimeException: com.tibco.cep.query.api.QueryException: java.lang.Exception: Identifier out of scope: /Events/EPAT/EPAD/EPAD_RLTM_VLDT_DAY_TIBCO_RSLT well
com.tibco.cep.runtime.model.exception.impl.BEExceptionImpl: java.lang.RuntimeException: com.tibco.cep.query.api.QueryException: java.lang.Exception: Identifier out of scope: /Events/EPAT/EPAD/EPAD_RLTM_VLDT_DAY_TIBCO_RSLT well
    at com.tibco.cep.query.functions.QueryFunctions.create(QueryFunctions.java:95)
    at be.gen.RuleFunctions.nullonQueryAgentStartUp$.onQueryAgentStartUp(nullonQueryAgentStartUp$.java:37)
    at be.gen.RuleFunctions.onQueryAgentStartUp.invoke(onQueryAgentStartUp.java:13)
    at com.tibco.cep.runtime.session.impl.RuleFunctionsExecAction.execute(RuleFunctionsExecAction.java:38)
    at com.tibco.cep.kernel.core.rete.ReteWM.invoke(SourceFile:401)
    at com.tibco.cep.kernel.core.rete.ReteWM.start(SourceFile:177)
. . .

Cause:
=====
When you use a group by clause, the properties of a concept or an event that can be used in the select clause are limited by the properties specified in the group by clause.

Wrong way:-
Select a,b,c from x group by a,b

Correct way:-
Select a,b,c from x group by a,b,c

Resolution:
=========
What fields you 'select' by you must 'group by'.


References:
==========
See note on page 13 in the "TIBCO BusinessEvents Event Stream Processing Query Developer’s Guide" under 'Group by Clause.

Issue/Introduction

"Identifier out of scope: " error when query against an event stream which aggregates one of the event properties.