How to filter XPath by child entity attributes

0
HIThe current situation is that there is an entity B that inherits from entity A, and entity B has a single Boolean property. Now, when using `Retrieve by xpath` in MF, the Return Object Type is A, but I want to filter based on the Boolean property of the child entity B. How can I do this?
asked
2 answers
1

As per my understanding of Mendix inheritance, entity B inherits from entity A. Therefore, B can access the attributes/properties of A, but A cannot directly access the attributes that are specific to B.

In this scenario, if the Boolean attribute belongs to entity B, we cannot directly use that child-specific attribute when retrieving entity A.

As suggested, one approach is to use entity B as the Return Object Type in the Retrieve activity and configure the required XPath condition based on the Boolean attribute of B.

At the UI level, if we are using Data Grid 2, we can configure the grid to display the attributes inherited from or defined in the parent entity A.

For example:

System.FileDocument (A)
         ↑
         |
    FileUploader (B)
         |
      IsActive

The Retrieve activity can be configured as:

Entity: FileUploader (B)
XPath: [IsActive = true()]

The data source retrieves B objects based on the configured XPath, and because B inherits from A, the Data Grid 2 can display the inherited/parent attributes from A, such as Name, CreatedDate, etc.

Therefore, B is used for retrieval and filtering, while the attributes from A can be used for displaying the required information in the Data Grid 2.

answered
1

Hi Bi Sung Kim,


In Mendix XPath, filter the parent (A) by the child (B) Boolean using the association path:


[YourModule.EntityA_EntityB/YourModule.EntityB/IsActive = true()]


This retrieves Entity A records that have a related Entity B where the Boolean is true.


answered