CMDBuild Forum

CQL Filter

Hy,

Is it possible to do a filtering for a reference Attribute like this: from tableA, tableB where Status='A'

Or a filtering with the column "IdClass" like this: from tableA where IdClass='"XY"' ?

 

thank you

Hi,
unfortunately the syntax you want to use is not allowed.
The filter on a reference could only extract/filter data from the destination class,
 
So, if you have:
  •  a domain between classA and ClassB
  •  a attribute reference (let's call it B) on classA referring to class B
you could define a filter on B like:
from classB 
and this filter will extract all the active data in classB. There is no need to add Status='A' to the query.
 
Filtering in multiple class is possible only if the classB is a superclass and you want to extract data just from some subclasses.
If you want to do this you have to use the nested SQL like this:
from classB where Id in (/( select "Id" from "ClassA" where "Status"='A' union select "Id" from "ClassB" where "Status"='A')/)
 
Best regards,
Tecnoteca
 

many thanks for the quick response, the filter works perfectly.

also thanks for the brilliant cmdbuild, it's great.

 

Previously Tecnoteca wrote:
Hi,
unfortunately the syntax you want to use is not allowed.
The filter on a reference could only extract/filter data from the destination class,
 
So, if you have:
  •  a domain between classA and ClassB
  •  a attribute reference (let's call it B) on classA referring to class B
you could define a filter on B like:
from classB 
and this filter will extract all the active data in classB. There is no need to add Status='A' to the query.
 
Filtering in multiple class is possible only if the classB is a superclass and you want to extract data just from some subclasses.
If you want to do this you have to use the nested SQL like this:
from classB where Id in (/( select "Id" from "ClassA" where "Status"='A' union select "Id" from "ClassB" where "Status"='A')/)
 
Best regards,
Tecnoteca
 

 

Previously Tecnoteca wrote:

Hi,
unfortunately the syntax you want to use is not allowed.
The filter on a reference could only extract/filter data from the destination class,
 
So, if you have:
  •  a domain between classA and ClassB
  •  a attribute reference (let's call it B) on classA referring to class B
you could define a filter on B like:
from classB 
and this filter will extract all the active data in classB. There is no need to add Status='A' to the query.
 
Filtering in multiple class is possible only if the classB is a superclass and you want to extract data just from some subclasses.
If you want to do this you have to use the nested SQL like this:
from classB where Id in (/( select "Id" from "ClassA" where "Status"='A' union select "Id" from "ClassB" where "Status"='A')/)
 
Best regards,
Tecnoteca
 

Hi, how to express "Not In" In CQL ?

Hi,
the NOT logical operator is expressed by the ! symbol.
This operator works, for example, with this common operators list:
=
NULL
IN 
It also works with obtain the logical not of boolean values like: ! (var1='working' & var2='example')
So, a working example could be:
 from Employee where Id ! IN (...)
 
CMDBuild Team

Well Thanks !! i was using CMDBuild 2.0.4 wich not support ( ! IN ) CQL but i upgraded to the new one, and it's works perfectly

 

Regards

 

Previously Tecnoteca wrote:
Hi,
the NOT logical operator is expressed by the ! symbol.
This operator works, for example, with this common operators list:
=
NULL
IN 
It also works with obtain the logical not of boolean values like: ! (var1='working' & var2='example')
So, a working example could be:
 from Employee where Id ! IN (...)
 
CMDBuild Team