You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To implement this, a self-reference to **Folder** is used. The self-reference is an association called **Folder_SubFolder**. This allows you to build a folder structure with unlimited numbers and levels of folders.
18
+
To implement this, a self-reference to **Folder** is used. The self-reference is an association called **SubFolder_Folder**. This allows you to build a folder structure with unlimited numbers and levels of folders.
19
19
20
20
{{% alert color="info" %}}
21
-
The association in this case is a one-to-many association, but the same techniques apply to many-to-many or one-to-one associations.
21
+
The association in this case is a many-to-one association, but the same techniques apply to many-to-many or one-to-one associations.
If we create our folder functionality in a module called **QueryOver**, the association **Folder_SubFolder** is described in two ways in the domain model:
26
+
If we create our folder functionality in a module called **QueryOver**, the association **SubFolder_Folder** is described in two ways in the domain model:
There are six folders in the example above, and the database is structured and the attributes filled as shown below. In the **Folder_SubFolder** table, the **ChildFolderID** is shown on the left as it is the owner of the association.
38
+
There are six folders in the example above, and the database is structured and the attributes filled as shown below. In the **SubFolder_Folder** table, the **ChildFolderID** is shown on the left as it is the owner of the association.
@@ -45,7 +45,7 @@ For more information on how domain models are implemented in databases, see the
45
45
46
46
If you have the $ChosenFolder object available in your microflow you can easily retrieve the subfolder(s). Each association has a right side (parent in the association) and a left side (child or owner of the association). The platform reads each association and determines whether the parent is equal to the $ChosenFolder.
47
47
48
-
This is implemented using the following XPath constraint: `[QueryOver.Folder_SubFolder=$ChosenFolder]`. The XPath constraint is read from right to left, with the resulting Folder(s) being the result. This is key to how you should interpret which direction you are following the association.
48
+
This is implemented using the following XPath constraint: `[QueryOver.SubFolder_Folder=$ChosenFolder]`. The XPath constraint is read from right to left, with the resulting Folder(s) being the result. This is key to how you should interpret which direction you are following the association.
@@ -65,7 +65,7 @@ Use the expression `[reversed ()]` to instruct Mendix to read the constraint in
65
65
The `[reversed()]` expression can only be applied on self-references. When an association is between two different object types, the platform will be able to determine the direction of the join automatically.
66
66
{{% /alert %}}
67
67
68
-
In our example, we want to find the folder which is the parent of $ChosenFolder. Now, the query becomes `[QueryOver.Folder_SubFolder [reversed ()]=$ChosenFolder]`. Instead of reading the association from right to left (Parent to Child), the association is read from left to right.
68
+
In our example, we want to find the folder which is the parent of $ChosenFolder. Now, the query becomes `[QueryOver.SubFolder_Folder [reversed ()]=$ChosenFolder]`. Instead of reading the association from right to left (Parent to Child), the association is read from left to right.
@@ -87,7 +87,7 @@ Say, for example, that each folder can contain multiple files, associated with t
87
87
88
88
You want to retrieve all the files in the parent folder of the folder object $ChosenFolder.
89
89
90
-
Use the constraint `[QueryOver.File_Folder/QueryOver.Folder/QueryOver.Folder_SubFolder [reversed ()]=$ChosenFolder]` to return all the **File** objects associated with the **Folder** which is associated (as parent) with the **Folder** which is the same as **$ChosenFolder**.
90
+
Use the constraint `[QueryOver.File_Folder/QueryOver.Folder/QueryOver.SubFolder_Folder [reversed ()]=$ChosenFolder]` to return all the **File** objects associated with the **Folder** which is associated (as parent) with the **Folder** which is the same as **$ChosenFolder**.
0 commit comments