self reference with extra information

0
hello, i'm currently trying to figure out a way to store extra information in a many to many self reference. to elaborate: I have a Task entity which stores its progress (perctage) and  is dependent on the completion of other tasks. So say I have Task C which depends on Task A at 85% and B at 76% to be complete. But then I have Task D which can start when Task A is at 70% and Task C at 90%. How can I implement this in Mendix? I was trying to do it with a second entity which stores the percentage level at when a task can be started but I'm hitting a wall trying to figure out how to do this.   any help will be greatly appreciated.
asked
3 answers
3

Just go with this:

and a rule that:

- retrieves all the ‘CanStartWhen’-objects for a Task,

- per CanStartWhen-object retrieves the ‘ThisTask’ from ‘Task’

- if all ThisTasks have reached the percentage, return true, else false

 

Doing the *-* relation it would look like this:

but in my opinion the first is easier to understand.

answered
0

You could create an extra progress entity where you store the progress of each task, and once a certain task is at a certain percentage, you set a boolean and use that to start the new task for instance.

 

Otherwise you should store the progress of each task in the task itself and check whether the progress is far enough to start the next task

answered
0

I think you might need a second entity indeed, something like:

Task entity: Has a number of attributes like status and current completion percentage. Also has a self reference

- Task requirement entity: Has two associations to task – one to the task this is a requirement for (so Task C in your example) and one to the tasks that are a requirement for this task. Also has an attribute “Percentage”. Make a page on which you can configure the task requirements. For every requirement the user creates, create a new task requirement entity and set the correct associations.

Now, when you need to check if task C is completed, retrieve all Task Requirements, and for each task requirement retrieve the corresponding tasks. Compare the Task Requirement percentage and the Task completion percentage, and if all requirements are met, then complete Task C.

answered