DataAccess: Access and interact with Solvas|Capital database (da_obj).

Description Usage Arguments Examples

Description

The DataAccess object is a required object which is always the first parameter passed to any of the other functions. The DataAccess object is created by the SERVER script and is passed into the required entry point of the model. The name of this required entry point is 'solvas_capital_model_run' and looks like this:

solvas_capital_model_run <- function(sc_da) ...

When the model is run on the server the server generates a script, creates the DataAccess object and calls solvas_capital_model_run defined in the model associated with the scenario.

When creating the DataAccessObject for local development the create_instruments can be set to true initially and the changed to to false after it is called once and the instruments are created. This will save time not having to re-generate the instruments.

Usage

1
2
DataAccess(connection_string_param = "", fs_id_param = NULL,
  event_id_param = NULL, create_instruments = FALSE)

Arguments

connection_string_param

- SQL Server connection string

fs_id_param

- Solvas|Capital scenario ID used in the run

event_id_param

- Solvas|Capital event ID of the scenario run (passed from the server or NULL for local development).

create_instruments

- If true and the scenario has not been run this will create a snapshot of instruments and properties for the passed fs_id_param

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Not run: 
For example: 
 
If the model to be uploaded is the following (minus header info):

 solvas_capital_model_run <- function(sc_da) {
   # insert model code i.e.
   DataAccess.FiInstrumentGet(sc_da, NULL, 1)
 }
 
 The server will generate something along these lines:

 # the user model injected here:
 solvas_capital_model_run <- function(sc_da) {
   # user code
   DataAccess.FiInstrumentGet(sc_da, NULL, 1)
 }
 # end user model injection
 
 # start of script code to create the DataAccess object from the parameters and run 
 the solvas_capital_model_run
 
 sc_da <- DataAccess(connection_string_param = sc_connection_string, fs_id_param = sc_fs_id, event_id_param = sc_event_id, TRUE)
 solvas_capital_model_run(sc_da)
 

## End(Not run)

deloitte-solvas/Solvas-Capital-R-Utility documentation built on May 15, 2019, 3:21 a.m.