I have a question.
My model is an appointment system. I want to count the total number of control patients for every week of the year and put them in table. week 1 = 10 , week 2 = 15.
But it doesn't work.
I hope someon can help me with this.
the attached model uses the function CalendarWeek to calculate a sum of all parts arriving in a certain week and writes them to the corresponding row in a table file.
Thans Ralf for your help!
And how how do i separate only the control patients in a column and not the total amount of patients?
Thank you advance,
You can put an if condition around the line which increments the number.
To differentiate the types you can define a custom attribute on the patient and set it to the correct type. Then you can check for the value of this attribute in the if condition.
So when the state of the patient is Control_short and the table has the name Number_of_short_term then i can use the following formula?
local currentWeek := CalendarWeek(EventController.Date+EventController.SimTime);
When "Control_short" then Number_of_short_term[1, currentWeek] := Number_of_short_term[1, currentWeek] + 1;
Or is this wrong?
Your code is missing one "end;" at the end. But otherwise it looks fine.
Instead of the inspect statement you might want to use a simpler if statement:
if @.state = "Control_short" then Number_of_short_term[1,currentWeek] := Number_of_short_term[1,currentWeek] + 1; end;
Now I get the following error: unknow identifier see attachment.
Do you know what is wrong?
It seems that the table Number_of_short_term cannot be found.
The method Slot_assignment is in the frame .Models.Main_Model.Planner.
The table has to be in this frame as well otherwise you have to specify the path to the table.
Thank you! this works.
Now I have one last question. Now i have the total nummber of control_short patients in the table file. But how do I get only the short-term control patients in that table that had an appointment in the specific weeks?( I have attached my model and maybe makes that is easier to take a look.)
I hope you can help me and then I'm really happy haha!
You could add another custom attribute at the patient of type table where you collect all the weeks where the patient had an appointment.
Then you can check this attribute later.