Inheritance, objects and page parameters

0
I have the following non persisted entities. Model A  – name  – age  – address   Model B   – nameIsValid  – ageIsValid  – addressIsValid I want model A to inherit from model B so that the object has all the members of model B when I pass it into the page as a parameter. Just spent some time trying to achieve this and trying all sorts but no luck. When both models are created, even if model A and model B have associations… Lets assume Model A inherits from Model B, when Model A is passed to the page as parameter, the object lacks access to model B members especially when trying to access the attributes. If you were to try and access using: $currentObject/modelA/modelB you get the error: mismatched input '<EOF>' expecting QUALIFIED_NAME I’d expect to get a reference to  any of the members from Model B. Here is what I am trying to achieve. Model A inherits from Model B ModelA : ModelB;   Create model A object new ModelA() Pass model A object with all members including those of model b. So the object becomes: modelAObject – name  – age  – address  – nameIsValid  – ageIsValid  – addressIsValid or do I need to create one big entity and there is no way of splitting it up?
asked
2 answers
0

Di you try to use the “object type decision” widget in a microflow, then cast your Model A Object into Model B object?

answered
0

From what I understand (but I could be wrong), you want to show both entity A and B on the same page. If I understood incorrectly, then ignore this answer. The question is a bit vague.

 

In order to do so, you need 2 data views.

- DataView of entity A, showing the attributes of A, and

- DataView of entity B, showing the attributes of B.

The DataView of entity B should be inside the DataView of entity A, so you can pick the association as a source for entity B.

 

If you wish to use a DataGrid for entity A, then you should do something similar;

- DataGrid of entity A, showing the columns with attributes of A, and

- DataView of entity B, showing the attributes of B whenever something is selected from the DataGrid.

The DataGrid of entity B should have "Listens to Widget” as a DataSource. The Widget to listen to is the DataGrid with entity A.

answered