getDefaultWorksetId {openMpp}R Documentation

Return default working set id

Description

Return default working set id for the model

Usage

getDefaultWorksetId(dbCon, defRs)

Arguments

dbCon

database connection

defRs

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

Details

Return id of model "default" working set of parameters.

If model have no default working set then execution stops.

Each model must have "default" workset. Default workset is a first workset of the model with set_id = min(set_id) for that model.

Value

Working set id: positive integer on success or negative on error. Stop 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

getModel getFirstRunId getLastRunId getWorksetIdByName 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 default working set id by name, it expected to be exist
  setId <- getDefaultWorksetId(theDb, defRs)
  
  # try to find "myData" working set id
  setId <- getWorksetIdByName(theDb, defRs, "myData")
  if (setId <= 0L) warning("workset not found: ", "myData")

  dbDisconnect(theDb)

[Package openMpp version 0.8.6 Index]