getWorksetIdByName {openMpp}R Documentation

Return working set id by name

Description

Return working set id by name

Usage

getWorksetIdByName(dbCon, defRs, worksetName)

Arguments

dbCon

database connection

defRs

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

worksetName

name of parameters working set

Details

Return working set id by name. If model have no working set with that name then return is negative. If model has multiple working sets with that name then return min(set id) with such name.

Value

Working set id: positive integer on success or negative 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 getDefaultWorksetId 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 <- getWorksetIdByName(theDb, defRs, defRs$modelDic$model_name)
  
  # 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]