Table of Contents

Table of Contents

FlexScript Class - StatisticsCollector

StatisticsCollector

Description

A class that represents a Statistics Collector

Properties

collectedData Provides access to data that may be used in Statistics Collector callbacks.

Methods

getRowForValue Returns the row number for given value, or 0 if that value is not tied to a row.
getValue Gets a value from the table created by the Statistics Collector.

Constructor

StatisticsCollector Creates a reference to a Statistics Collector.

Static Methods

getID Returns a unique ID for a node.
getPathFromID Gets the path used to generate an ID for the node.
StatisticsCollector Creates a reference to a Statistics Collector.

Details

Do no remove, this fixes the anchor on doc.flexsim.com

StatisticsCollector.collectedData

readonly StatisticsCollector.CollectedData collectedData

Description

Provides access to data that may be used in Statistics Collector callbacks.

Do no remove, this fixes the anchor on doc.flexsim.com

StatisticsCollector.getRowForValue()

int getRowForValue( Variant value )

Parameters

value The value to find a row number for

Returns

int A row number

Description

Returns the row number for given value, or 0 if that value is not tied to a row.

This method can be used to determine whether a value currently has a row in the current collector. For example, if the row mode is set to Unique Row Values, and you are listening to multiple events, it could be that you want to allow an event to update the row for the value, but prevent that value from adding a row. In this case, the event's Condition might have code like this: collector.getRowForValue(data.item)
Do no remove, this fixes the anchor on doc.flexsim.com

StatisticsCollector.getValue()

Variant getValue( int row , int col , int skipUpdate = 0 )

Parameters

row The row of the desired value
col The column of the desired value
skipUpdate Choose whether the table should update its values before retrieving the data.

Returns

Variant A Variant, the value from the table.

Description

Gets a value from the table created by the Statistics Collector.

This method is intended to be used within one of the Statistics Collector's callbacks. In certain cases, it can be desirable to get a value without causing an update of all Always columns that are still being tracked. This method can also be used to get a value from the collector's table without wrapping the node in the Table constructor.
Do no remove, this fixes the anchor on doc.flexsim.com

StatisticsCollector Constructor

static StatisticsCollector( Variant id )

Parameters

id The value that specifies a Statistics Collector

Returns

StatisticsCollector A StatisticsCollector reference.

Description

Creates a reference to a Statistics Collector.

Global Statistics Collectors can be referenced by name or by rank. A Statistics Collector's node can also be used.
Do no remove, this fixes the anchor on doc.flexsim.com

StatisticsCollector.getID()

static double getID( treenode object )

Parameters

object The node to get an ID for

Returns

double The ID of the node

Description

Returns a unique ID for a node.

All Statistics Collector IDs are generated as they are needed. The first time an object is passed to this method, a new ID will be generated. Subsequent calls to this method for the same treenode will return the same ID. If the node is temporary, such as a flowitem, token, or any node that will be destroyed on reset, then the ID will be a incrementing number, starting with 1. If the node is more permanent, then an ID will be generated by hashing the full path of the object.
Do no remove, this fixes the anchor on doc.flexsim.com

StatisticsCollector.getPathFromID()

static string getPathFromID( double id , int maxDepth = 0 )

Parameters

id The ID to retrieve a path for
maxDepth The number of names to show in the returned path.

Returns

string The path used to create the given ID.

Description

Gets the path used to generate an ID for the node.

If the ID is valid, and does not refer to a temporary object, this method returns the path that was used to create the ID. If maxDepth is greater than 0, the path will be shortened, so that only maxDepth names will appear in the path. If the ID is not valid, or refers to a temporary object, then an error text will be returned.
Do no remove, this fixes the anchor on doc.flexsim.com

StatisticsCollector Constructor

static StatisticsCollector( Variant id )

Parameters

id The value that specifies a Statistics Collector

Returns

StatisticsCollector A StatisticsCollector reference.

Description

Creates a reference to a Statistics Collector.

Global Statistics Collectors can be referenced by name or by rank. A Statistics Collector's node can also be used.