CMDBuild Forum

How to define View Condition (CQL) for a domain?

Hi,

I want to filter data from a domain N:N with a {client:attribute.id} of the card and see the filtered items in the grid for selecting then.
I’ve started with simplificated sentences like

`WHERE IdObj1 = 1234;`

`WHERE IdClass1 = 'InventoryItem';`

`FROM Map_SiteInvetory WHERE IdObj1 = 1234;`

` FROM Site WHERE Id  = 1234;`

,but the interface never store the CQL at the domain and I can’t test it

The full case is:

Superclasses: Contract, Site, InventoryItem
Realtions

  1. Map_ContractInvetory (N:1): [Contract]--n-<>-1--[InventoryItem]
  2. Map_ContractSite (N:N): [Contract]--n-<>-n--[Site]

Card Contract {Code: 123, Descripcion: AAA, Inventory (Reference:Map_ContractInvetory), Sites (Inline: Map_ContractSite)}

CQL

FROM Site WHERE Id IN (/(

SELECT “IdObj1”
FROM “Map_SiteContrat”
WHERE “Status”=‘A’
AND “IdObj1” IN (

SELECT “IdObj2”
FROM "Map_ContractInvetory "
WHERE “Status”=‘A’
AND “IdObj1”::varchar = ‘{client:Inventory.Id}’::varchar
)
)/)
;

I’m not sure IF:

  • the View Condition (CQL) box runs OK or has a bug;
  • the sentence begins with Where or From;
  • it’s possible use client calls like {client:Inventory.Id}

Hi again,

About Domains’ View Condition box
View Condition CQL BOX
Have anyone used it? Have anyone got an input sample?
A negative answer is legitimate for me too.

I’m not sure IF:

  • the View Condition (CQL) box runs OK or has a bug;
  • the sentence begins with Where or From;
  • it’s possible use client calls like {client:Inventory.Id}

Not sure what exactly you are trying to achieve here. As I can see from the screenshot - you have 1:N relation, suppose you have a field of type reference using this domain => you can apply filter to a specific field using this domain.