getLastRunId {openMpp}R Documentation

Return id of last model run results

Description

Return id of last model run results

Usage

getLastRunId(dbCon, defRs)

Arguments

dbCon

database connection

defRs

model definition: database rows describing model input parameters and output tables

Details

Return last (most recent) id of model run results, it is positive integer. If model does not have any run results (model never executed) then return negative value.

Value

Run id: positive integer on success or negative on if not found.

Note

To run examples you must have modelOne database modelOne.sqlite in current directory

Author(s)

amc1999

References

OpenM++ documentation: https://github.com/openmpp/openmpp.github.io/wiki

See Also

getFirstRunId getModel getWorksetRunIds

Examples

  theDb <- dbConnect(RSQLite::SQLite(), "modelOne.sqlite", synchronous = "full")
  invisible(dbGetQuery(theDb, "PRAGMA busy_timeout = 86400")) # recommended

  # get model by name: use such call if you have only one version of the model
  defRs <- getModel(theDb, "modelOne")

  # get first run id of that model
  runId <- getLastRunId(theDb, defRs)
  if (runId <= 0L) warning("model run results not found")

  dbDisconnect(theDb)

[Package openMpp version 0.8.6 Index]