OQL Distinct function does not return objects

Hello all,   I am currently working with OQL and want to retrieve a list of objects based on one unique value (Publicatiejaar) Whenever I use the DISTINCT function to retrieve the unique objects, the OQL query does not return any object.     'SELECT DISTINCT Publicatiejaar FROM Publicaties.Publicatie AS Publicatiejaar'   When I execute without the distinct the function works fine.   What is wrong with this query? I would like to return a list of NP objects with unique years.   When I execute a similar query in Pgadmin it returns the objects:   SELECT DISTINCT Publicatiejaar FROM public."publicaties$publicatie" ORDER BY Publicatiejaar ASC Kind regards,   Roy
2 answers

Hello Roy,

The following should work:

SELECT DISTINCT Publicatiejaar FROM Publicaties.Publicatie 

However I see your offset is set to 100, this might cause the list to be empty, if the result is less then 100 rows.


I would recommend putting the OQL snippet (provided in the _USE_ME directory of the module) on a test page. Try and test the OQL Query there before putting it in a microflow.


Hi Roy,


I expect that the Publicatiejaar is part of the Publicaties.Publicatie entity. 

If so, try the following query:

SELECT DISTINCT Pub.Publicatiejaar AS Pubjaar
FROM Publicaties.Publicatie AS Pub

Then you need to make sure that Pubjaar is an attribute in the return entity.