Developer forum

Forum » PIM » Query showing Products with no Related product

Query showing Products with no Related product

Justin Sjouw Dynamicweb Employee
Justin Sjouw


I'm working on a case where the customer want's to see a list of products that should have an accessory connected, but does not have one at this moment.

The idea is the products will have some sort of field that specifies wheter it should have an accessory, like a boolean "Must Have Accessory", and we then query on products that have this set to true, but have no related product in a specific related group "Accessories"

Can I achieve this with standard query's/indexes?




Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen

Hi Justin

Yes - you should be able to do that.

In the index, add a new field - each relation group exposes a field from the schema called "ProductRelationGroup_*" that contains a list of products related to a given product in a given relation group.

The field can be a string or string array. Then add it to your query to find fields that are empty - using isempty expression.


You must be logged in to post in the forum