Combination microflows and reference

Dear, I am making a Mendix project and want to model a situation in which a patient is begin registered at a health care system. The patient has to fill in a survey in order to determine the care group he or she belongs to. I'll tell you the simplified situation. There is an object called patient, which containes the attribute care group. Care group is modelled as an enumeration with values Acute, Rehabilitation and Psychiatry. I have put the value source on database (not on microflow) because in some cases a survey isn't needed (the doctor can assign the patient to a care group in clear situations). Besides that there is another object, it is called SurveyScore and consists of 8 attributes which are all questions of the particular survey. All the values of this attributes (questions) are enumerations. I have made an association between the object Patient and SurveyScore. I've added a summary in picture below. Each answer on a particular question has a weight which belongs to a care group. So what I want to do is compute for each Care Group the score and determines to which care group a patient belongs. I used a microflow for this with 2 exclusive splits. The exclusive splits contain an expression which states that the summation of the scores on a particular care group is higher than on the other care groups. If this is true, you will be come in the first end conditions. There are 3 end condition, each belonging to a care group. What I would get is stated below. When clicking on Add there will be a screen and there I can click on the button 'new'. That will allow me to fill in the survey results. But by doing that, I will select that particular row of survey results. What I want then is that by clicking on that row of scores automatically the care group will be determined. To accomplish this, we have created 3 'change objects', 1 after each exclusive split arc. We will change of the object 'patient' the member 'care group'. But when doing all this, it doesn't lead to an automatic calculation of the care group. After this we tried to use a microflow button on the place of care group as in the picture above. But after implementing this button, there is an error which states that there should be one parameter of the type patient. Overall, this problem could be seen as using in the microflow a variable outside of the object in which you will change something. So it is a combination of a microflow and reference. Who can help me with this problem?
1 answers

Make a screen with a Client data view and in that data view a data grid with SurveyScores belonging to that Client (i.e. retrieve them over the association).

Make a microflow with two parameters: a Client and a SurveryScore. This microflow calculates for a given SurveyScore object the category. Add a change object action to change the attribute of the Client.

You can add the microflow to the control bar of the data grid. This microflow should pass both the selection (the SurveyScore) and the enclosing object (Client). This can be changed by right clicking the microflow button and selecting the edit microflow settings option.