Count Selected Objects

Counts the number of Objects selected using the “Select Simulation Object” command. The count is returned in the specified Global Data Item.

Parameters

Global Data Item: a number variable to return the count.

Comments

Can be called at any time (but most likely after having used the “Select Simulation Object” command). It can often be useful when you count Objects in Groups, as you need to make sure that when carrying Objects from one Group to another, you delete the carried Object from the previous Group.

Annotated Example

In the example below, Visual Logic finds all the Activities in the simulation using the LOOPOBJECTS all command, selects them using the Select Simulation Object command, and counts how many are selected. The result is saved in the gbl_CountObjects variable.

Related Commands