Get associated items by OQL

0
Hello. I would like to ask how to get data with reference by OQL. I make a domain model with self-reference association like below.   I wrote this OQL, but the result is the list without reference. I cannot get associated data. FROM Folder LEFT OUTER JOIN Folder/Folder_SubFolder/Folder How can I get ‘Folder’ data as well as ‘SubFolder’ data?
asked
2 answers
0

Hi Taiga,

OQL is not like xpath you have some limitation.

Did you already checked the playground app : https://service.mendixcloud.com/p/OQL

It helps to understand the OQL a bit better.

 

Try:

select Name from MyFirstModule.Folder f
join f/MyFirstModule.Folder_SubFolder/MyFirstModule.Folder a;

answered
0

That would be:

from yourdomain.Folder F
join F/yourdomain.Folder_SubFolder/yourdomain.Folder SubF
select *

You will get a denormalized, flat file. So not grouped by folder:

- folder a, subfolder x

- folder a, subfolder y

- folder a, subfolder z

- folder b, subfolder g

Also, you probably need the association the other way to have one folder have many subfolder.

 

answered