How to get the name of time table assigned to a resource?

How to get the name of time table assigned to a resource?

asb_praneeth
Not applicable
82 Views
2 Replies
Message 1 of 3

How to get the name of time table assigned to a resource?

asb_praneeth
Not applicable

[ FlexSim 17.0.12 ]

Hello,

In my model,I have assigned only one time table to a each resource.

I am trying to prepare a simple GUI which helps the users to change shift of the resources. For setting current item of the combo box when the GUI is open I am trying to read the shift assigned to perticular object but i could not able to get the value of the timetable node. Below is the code snippet I have written for this purpose. @Ben Wilson @Matthew Gillespie @Brenton King @Arun KR @Jacob Gillespie

Please let me know how to get the time table assigned to a object.

10517-capture.jpg

treenode timetablenode = mem.find(">variables/timetables");
treenode timetable = timetablenode.subnodes[1];
string text = timetable.value; //this line code is coming as null
Array Str = text.split(">");
string text1 = Str[1];
Array Str1 = text1.split("/");
String timetableName = Str1[3];
		
0 Likes
Accepted solutions (1)
83 Views
2 Replies
Replies (2)
Message 2 of 3

Matthew_Gillespie
Autodesk
Autodesk
Accepted solution

The subnodes under the timetables variable have coupling data, not string data. The .value property on a node with coupling data will return the node it's point at. However, this node is a node inside the members variable on the timetable. You then need to use the ownerobject command to get the actual timetable node.

treenode timetableVar = getvarnode(mem, "timetables");
treenode varSubnode = timetablenode.subnodes[1];
treenode timetableSubnode = timetable.value;
treenode timetable = ownerobject(timetableSubnode);
string name = timetable.name;


Matthew Gillespie
FlexSim Software Developer

Message 3 of 3

matt_long
Not applicable

It's a bit simpler than that @Arun KR, you don't need to do all the extra getting of the path/string manipulation.

treenode tableNode = model().find("Processor1>variables/timetables/1").value;
string tableName = ownerobject(tableNode).name;

The /1 at the end of the find() command gets the first subnode of the timetables variable (regardless of the name).

Since the object is coupled to a subnode of the Time Table, you can get the ownerobject of that subnode (the Time Table) using the ownerobject() command.