question

David Seo avatar image
0 Likes"
David Seo asked Matthew Gillespie answered

how to get the index number of the group member in 2017.0.12 version

I can't find the command of Group.indexOf() of 2018 version in the 2017.0.12 version. I want to know how to get the index number of the group member in 2017.0.12 replacing with Group.indexOf() in 2018 version. How can I use the script in the 2017.0.12 for same result?

FlexSim 17.0.12
index number of the group member
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
2 Likes"
Matthew Gillespie answered

The indexOf method was added in 17.2. There is no analogous command in 17.0, however you could use the groupmember command and a for loop to get the same functionality:

//indexOf

string group = "Group1";
treenode obj = model().find("Processor1");

for(int i = 1; i <= groupnummembers(group); i++) {
	if(groupmember(group, i) == obj )
		return i;
}
return -1;
5 |100000

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

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.