I have an project entity associated with an controlling entity. A variable in the controlling entity will be
calculated throug a microflow. How can I set the association between the main and subentity in the retrieving action with xpath?
The '[%CurrentObject%]’ token can only be used in XPath constraints in the user interface. In microflows, you need to reference an object (and objects start with a $ sign).
Looking at your microflow, you will not be able to retrieve the data you want: you only have a Controlling_Eingang object at your disposal, and you try to retrieve a list of Controlling_Eingang. I don't know your domain model, but you either need to change your input object to the main entity (if Controlling_Eingang is your subentity), or you need to retrieve a list of your sub entity if (Controlling_Eingang is your main entity). If the start of your XPath constraint is correct, and the type of the list is correct, then you would need an input parameter of entity Project_Projektverwaltung.
Finally a suggestion on naming your entities: associations in Mendix are named EntityName1_EntityName2, so to easily distinguish associations from entities, you should avoid the _ symbol in the names of your entities.
To be honest, I don't have any idea what you are trying to achieve; but let me show an example how to model in Mendix.
Below I set the association to a Parent for all children without a Parent. I first retrieve the children, then set the association in a loop and finally commit that list to the database. Does this help?
Kind regards, Johan
Allright, I see three options:
I think to make my problem clear look for the following picture:
Now I want to automtically fill in the value attribute in controlling depending on the parent “Project”.
To SET an association, you should CHANGE an object and let the association refer to another object. You are now using the RETRIEVE action, which does like Rom says.
You cannot use current object here. Before you do this retreive, you have to make sure you have your project object available. THis can be done by first retrieve your project. Then you can that currentobject to that retreived object.