NextActivity

Description

Provides the next activity in a trace file.

Applies to

TraceFile objects

Syntax

instancename.NextActivity ( )

Argument

Description

instancename

Instance name of the TraceFile object

Returns

TraceActivityNode

Usage

You use the NextActivity function to read the next activity in a trace file. The activity is returned as a TraceActivityNode object. If there are no more activities or if the file is not open, an invalid object is returned. You can then use the LastError property of the TraceFile object to determine what kind of error occurred. To use this function, you must have previously opened the trace file with the Open function. You use the NextActivity and Open functions as well as the other properties and functions provided by the TraceFile object to access the contents of a trace file directly. For example, you would use these functions if you want to perform your own analysis of the tracing data instead of using the available modeling objects.

Examples

Example 1

This example opens a trace file and then uses a user-defined function called of_dumpactivitynode to report the appropriate information for each activity depending on its activity type:

String ls_filename, ls_line

TraceFile ltf_file

TraceActivityNode ltan_node

ls_filename = sle_filename.text

ltf_file = CREATE TraceFile

ltf_file.Open(ls_filename)

ls_line = "CollectionTime = " + &

    String(ltf_file.CollectionTime) + "~r~n" + &

      "Num Activities = " + &

        String(ltf_file.NumberOfActivities) + "~r~n

mle_output.text = ls_line

ltan_node = ltf_file.NextActivity()

DO WHILE IsValid(ltan_node)

    ls_line = of_dumpactivitynode(ltan_node)

    ltan_node = ltf_file.NextActivity()

    mle_output.text = ls_line

LOOP

See also