question

michael.smith avatar image
0 Likes"
michael.smith asked Matthew Gillespie commented

Adding Members to Timetable Dynamically/Command (HC)

I need to add specific staff members to a variety of timetables based on data loaded into the model. I can see in the tree that the reference is held in both the Timetable and the Object (Staff Member) I've also had a look inside the TimeTable Object code but I'm not sure exactly how to use the add functions. Is there a simple way to add the objects? Can I add the reference (Staff Name) to the Timetable Object?

FlexSim HC 5.0.12
codetimetablecommandcommand line
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered Matthew Gillespie commented

Here is the path to the code that's run when you add a member to the shift schedule member list:

VIEW:/standardviews/modelingutilities/QuickProperties>variables/propertiesPanels/

ShiftScheduleMembers/ShiftScheduleMembers/ButtonPanel/Add>eventfunctions/addMember

Here's the core of that code:

treenode members = getvarnode(timeTable, "members");
treenode objPointer = assertsubnode(members, name, DATATYPE_COUPLING);

treenode tables = assertvariable(obj, "timetables", DATATYPE_STRING);
treenode tablePointer = assertsubnode(tables, getname(timeTable), DATATYPE_COUPLING);

nodejoin(objPointer, tablePointer);

Basically you just need to add a coupling subnode to the members variable of the shift schedule and a coupling subnode to the time tables variable of the object and then join them together.

· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

elizabeth.l avatar image elizabeth.l commented ·

What about removing a member from a time table?

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ elizabeth.l commented ·

Just delete one of the subnodes on either end. So on the member you could find the correct timetable in its timetables variable and delete that subnode, or on the timetable find the correct member in its members variables and delete that subnode.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.