Mendix flexibility

Dear community, I have an assignment in which i have to create an activity tracking app. see below for the description of the assignment  A designer has created a mockup for a new healthcare information system: the  health portal. This system can be used by patients to track their health status on a day by day basis by recording themselves the health-related activities they perform. Particularly, patients can record episodes of physical activity they engaged in, track their dietary intake, as well as log measurements of bodily functions, also see Screen 1 and Screen 2   Each activity type has a specific set of associated property types that are used to record details of a particular activity. For example, for all activity types, the date of recording the activity into the system, as well as the start date, the end date, and the duration of the activity are recorded. Additionally, for example for walks, the number of calories in kCal and the number of steps are recorded. Similarly, for measurements of body mass index, the patient’s height in cm, weight in kg and consequently body mass index in kg/m2 are recorded The system must be flexible enough to allow for new activity types (e.g., runs) and associated properties to be created at any point in time using just the interface of the health portal. Here it is stated that an admin should be able to create an activity only using the interface. The patient should then be able to use this activity to save his/her progress.   The assignment states that I as an administrator should be able to create activities (including attribute) in the app without going to mendix studio pro and adding new entities. is this possible?   Thanks in advance!  
3 answers

As said earlier it is not undoable but quite hard for a person starting in Mendix. The standard fields are no problem. They all have a picture, name and a begin and end datetime fields. The hard part is the dynamic part. Create an entity for this and attach it to the first entity (one to many). Now for each attribute you need to store the name of the attribute, the type of field it is (create an enum with string, decimal, integer etc) and offcourse all the attributes for each enum. So that second entity contains name attribute, type attribute (the enum), decimal attribute, boolean attribute, string attribute, integer attribute etc.). Then create the form where the admin can add this entity to the main entity and define the fields to show. After selecting the Type show with conditional visibilty to correct field to show where the end user can enter the value.






However, there is still something I don’t really understand and it has to do with this part of your comment: “Then create the form where the admin can add this entity to the main entity and define the fields to show. After selecting the Type show with conditional visibilty to correct field to show where the end user can enter the value.” 

I’ve taken the following steps

I have coordinator page in which new activity types can be made. Each activity type has the following attributes:

- Name (String)

- Readable by patient (Boolean)

- Editable by patient (Boolean)

- Readable by doctor (Boolean)

- Editable by doctor (Boolean).

Furthermore, I have implemented a reference set selector within the Activity_type_NewEdit page, in which the attributes related to that activity type can be assigned.

This also means I made a tab in which new attribute_types can be created. Each attribute type has the following attributes:

- Name (String)

- Attribute type (Enumeration with as enumeration values: String, Decimal, Long, Date and time, etc.)

This is how it looks like

On the patient page, I have created a data grid in which all activities (NOT activity types) are listed. A patient can also create new activities. When the 'New' button is clicked, the page activity_NewEdit is shown, in which a reference selector asks for the associated activity type. This is also the point where I get stuck. How can I make the system show all associated attributes to a specific activity type, once I have selected that specific activity type in the reference selector? And how do I then give input to these attributes (so for recording date, how do I connect a date to that? this is the mock-up and as you can see a patient can select an activity and then the attribute fields show up. These fields can then be filled in. So my question is how can I also implement this?


I have managed to create an admin page in which he/she can create attributes and activities (see pictures below) 

this is where the attributes are created

this is where a new activity is created and the attributes are added 

Right now I’m able to create attributes and activities

you can type the name of the activity you want to create, and then with the add button one can add the needed attributes

I have also created a patients page in which a patient can select an activity and fill in the needed values

When a patient clicks on new, he/she can add a activity

This is how it looks like

But the problem I have here is that when a patient selects an activity she sees the following and is not able to fill in a form


So my question is when a patient selects an activity in the drop down how can I make it show a form that he/she can fill in?

Thanks in advance! I really appreciate it, your comments have helped me a lot!