cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HOPEX V1R3 - In Query Group condition with Having Count

Highlighted
Occasional Contributor

HOPEX V1R3 - In Query Group condition with Having Count

Hello,

 

We have created a MetaAssociation between Concept and Application. So we can link several Application to one Concept and associate a value to these links: "CRUD", "RU", etc...

We would like to create a query in order to list all Concepts linked to at least 2 applications with the Association value = "CRUD"

 

We made several tests:

- Select [Concept] Where [Defined object]:[Application].[Airbus - Application Concept] = "CRUD" HAVING COUNT > 1

Not good: list all Concepts linked to several Applications, one of which is linked as "CRUD"

 

So we tried to group the condition as explained on MEGA doc but does not work with "having count" operator:

- Select [Concept] Where [Defined object]:[Application].([Airbus - Application Concept] = "CRUD" And Having count > 1)

- Select [Concept] Where [Defined object]Smiley Sad[Application].[Airbus - Application Concept] = "CRUD" And [Application] Having count > 1)

Not good: Syntax Error: invalid SELECT phrase

 

Could you help us?

 

Regards,

Benjamin Poncept

-

2 Replies
Frequent Contributor

Re: HOPEX V1R3 - In Query Group condition with Having Count

Not sure if you could achieve this using the ERQL queries.

 

One workaround would be to create a macro based query where you could for example get all concepts associated to at least 2 applications. Then for each of those concepts loop through each association with an application and see if it is of type "CRUD"; if it is, increment a counter by 1; if at the end the counter for that concept is > 1, then add that concept to the query result collection. There's probably more efficient ways to code this Smiley Happy

 

Hope this helps!

Philippe

MEGA Partner

Re: HOPEX V1R3 - In Query Group condition with Having Count

Try the following:

Select [Concept] into @concept Where [Defined object]:[Application].([Airbus - Application Concept] = "CRUD"
Select [Concept] from @concept Where [Defined object]:[Application] Having Count > 1