package require logbook set book [logbook::logbook open mylogbook] set run [$book currentRun] if {$run eq ""} { puts stderr "There is no currently active run" } ...
set key [$run id]
set number [$run number]
set title [$run title]
set transitions [$run transitions]
if {[$run isActive]} { puts "The run is active" }
$run destroy
Run instance objects are command ensembles that encapsulate a single run. Instance objects don't get created directly by your script. They are returned from some of the API subcommands in logbook instance as shown, for example, in the SYNOPSIS section.
Run instance objects encapsulate resources and, when no longer needed, those resources must be released using the destroy subcommand.
Destroys the instance and releases any resources it may have. The instance command is removed from the interpreter.
Returns the primary key that was assigned to the encapsulated run.
Returns the number of the run encapsulated by this object.
Returns the title of the run encapsulated by this object.
Returns a list of dicts that describes the transitions this run has undergone. Each run will have at least one transition (the begin run is what creates the run). The keys and values in these dicts are described in TRANSITION DICTS below.
Returns a boolean that is true if this run is the active run.
A transition dict is a Tcl dict that describes one transition. The transitions subcommand of the run instance command returns a list of these describing the transition history of the run.
Each transition dict contains the following keys:
The primary key value assigned to the transition by the database.
An integer code that describes the transition.
See the table of values in
State transition values
in the reference page for LogBookRun
for possible values.
Contains a text string that describes the transition.
See the table of values in
State transition values
in the reference page for LogBookRun
for possible values.
The clock seconds at which the transition was logged. clock format can be used to create a human readable date/time string from this value.
A shift instance that encapulates the shift that was on duty when the transition was logged. See shiftinstance for information about shift instances.