NextActivity PowerScript function
Description
Provides the next activity in a trace file.
Controls
TraceFile objects
Syntax
1 |
<span>instancename</span>.<span>NextActivity</span><span> </span>( ) |
Argument |
Description |
---|---|
instancename |
Instance name of the TraceFile object |
Return Values
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
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:
1 |
String ls_filename, ls_line |
1 |
TraceFile ltf_file |
1 |
TraceActivityNode ltan_node |
1 |
ls_filename = sle_filename.text |
1 |
ltf_file = CREATE TraceFile |
1 |
ltf_file.Open(ls_filename) |
1 |
ls_line = "CollectionTime = " + & |
1 |
String(ltf_file.CollectionTime) + "~r~n" + & |
1 |
"Num Activities = " + & |
1 |
String(ltf_file.NumberOfActivities) + "~r~n |
1 |
mle_output.text = ls_line |
1 |
ltan_node = ltf_file.<span>NextActivity</span>() |
1 |
DO WHILE IsValid(ltan_node) |
1 |
ls_line = of_dumpactivitynode(ltan_node) |
1 |
ltan_node = ltf_file.<span>NextActivity</span>() |
1 |
mle_output.text = ls_line |
1 |
LOOP |