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.

Hi everyone,
I have a similar question. I need to filter out the current card in the “Edit Relations” tab when using an N:N
Domain linked to the same class as both the destination and source. Is it possible to achieve this using domain CQL?

I think I have the same question. I have a domain like this:
Domain Name: PABX_PhoneList (1:N)
Class Origin: PABX, attribute SUBSCRIBER(String)
Class Destination: PhoneList, attribute PHONE_LIST_NUMBER(String)

In PABX class I have an attribute name “SUBSCRIBER”, type String, with a compose values.
For example:
Card: 1, attribute SUBSCRIBER: “ClientA_Telefonica
Card: 2, attribute SUBSCRIBER: “ClientB_Vodaphone
Card: 3, attribute SUBSCRIBER: “ClientC_Telefonica
Card: 4, attribute SUBSCRIBER: “ClientD_DeutshTelekon
Card: 5, attribute SUBSCRIBER: “ClientE_Vodaphone

I would like to known, if based on first part of attribute name like “*ClientA_" or "*ClientC_”, only a especific range of attribute PHONE_LIST_NUMBER is shown as option to be selected.
For example:
In PhoneList class I have hundred of cards with phone numbers, but if the name of a subscriber in class PABX contains “ClientA_” or “ClientB_” only ten numbers from PhoneList class is shown as avaliable.