Hi to all of you, I have the following entities: As you can see, every Cost Center is associated with an upper unit, the "Organisational Unit". Furthermore, I've got the following pages: "Home", where all organizational units are displayed through a list view: By clicking on the "Show Planning"-Button, you get redirected to the following page, which has the Organizational Units as page parameter and which displays the Planning of the Organizational Unit you clicked on before on the homepage. You can see that this is rendered possible by a xpath constraint and the Planning entity. The xpath constraint is the following: [CostCenter_Module.Planning_CostCenter/CostCenter_Module.CostCenter/CostCenter_Module.CostCenter_DeliveryUnit/CostCenter_Module.DeliveryUnit/CostCenter_Module.DeliveryUnit_OrganisationalUnit/CostCenter_Module.OrganisationalUnit/id="[%CurrentObject%]"] Now I want to add a Planning unit by clicking on the "Add"-Button. By doing this, I get redirected to the following page: And now we're getting to my problem: By creating a new planning object I have the option to select the cost center via reference selector. But I get a list of all available cost centers. I just want a list of cost centers which are associated to the organisational unit (DataView on the Planning Page). I already found out that in the settings of the reference selector, I have the option of "selectable objects" and that I can use XPath for that. However, I wanted to create a xpath constraint that is like: ["Module.CostCenter_OrganisatoinalUnit/Module.OrganisationalUnit/OrganisationalUnit=$OrganisationalUnit] or with %CurrentObject% , just as I did before on the Planning Page. But this time, it doesn't pass the organizational Unit object to the Add-Page, so the xpath constraint doesn't work anymore. So, my problem in a nutshell: On the "Add"-page, I only want all the cost centers to be selectable which are related to the organizational unit I clicked on at the beginning. Is this in any way possible? I already got the tip with the "constrained by" - function which is explained here https://docs.mendix.com/howto40/constrained-by-functionality-for-a-reference-selector, but I think it's not quite what I'm searching for; yes, I want the reference selector to be constrained by the orgunit, but I don't want to do it through another reference selector but "automatically" by the passed organizationunit-object. So I'm rather looking for a way to pass the orgunit to the add-page so the whole page is determined by it. Best Regards and many thanks in advance, Laura
Ok, let me give it a try as well.
Create a custom Add button that calls a microflow taking the organization as input parameter. However in contrast to Tim's solution (to me it is not clear were the planning object is created in this solution), create a Planning object and set the association to the Organization. Pass this new Planning object to the existing Planning_NewEdit (the page you included in your screenshot).
Finally, in the tab Selectable objects of your CostCenter ReferenceSelector, use the ConstrainedBy to constrain over the Planning_Organization association.
This should do the trick.
Have the Add-button call a microflow that takes as inputparameter the Organisation and have the microflow Open-page the Add-planning-page. On the add planning page also place a dataView having the Organisation source, so as page parameter. Within the dataview place your Planning-fields and buttons.
𝕿𝖎𝖒 𝖛𝖆𝖓 𝕾𝖙𝖊𝖊𝖓𝖇𝖊𝖗𝖌𝖊𝖓
Being able to pass more than just one single object to activity open page would make it easier: https://forum.mendix.com/link/ideas/732
Tim van Steenbergen
The easiest and most effect solution to your problem would be to create a temporary Template entity. You can associate Organisational Unit to this entity and this template entity would be the main entity to the page. You can create an object of this template entity when the user presses the New button and delete it when Save/Cancel.
I hope this helps.
Sharad R K
thank you! I did this so far:
The microflow leads to the "Add Planning" page. But I still get errors:
"The selected page 'PlanningAdd expects an object of type OrgUnit which is not compatible with the object of type 'Planning' that is available here."But actually I need the Planning object because the Button is there to create a Planning object. Initially, the "Add-button" was a Create Button.
"All data views receiving object from from the page parameter must have the same entity"
"A nested data view with data source 'Entity (path)' should specify a path over an association, not simply an entity." But as there is no direct association between the Orgunit entity and the Planning entity, this doesn't seem to be possible. I don't want to associate the two entities with each other as it would reduce data quality.
So, how can I overcome these errors now?
Please note that I am an absolute beginner and do not have any developer skills, I'm still at the beginning but I am trying to learn and understand.
Thank you so much in advance!
Add Jeroen's suggestion to mine and indeed in the microflow: Planning has to get the reference to the OrgUnit added and then call the page where Planning is the page parameter (don't add Organisation as the pageparameter).
Now you will have the organisation available and you will be able to use the same XPath you used at the start.