Type | Read/write | Author | Availability |
---|---|---|---|
Write | FINBOURNE | Provided with LUSID |
Providing you have sufficient access control permissions, the Lusid.FundConfiguration.Writer
provider enables you to write a Luminesce SQL query that creates, updates or deletes fund configuration modules in LUSID.
Note: By default,
Lusid.FundConfiguration.Writer
cannot add properties to modules. To do this, you must first configureLusid.FundConfiguration.Writer
to 'inline' properties. See how to do this.
The purpose of a fund configuration module is to identify general ledger account(s) recording the following activities: dealing, P&L and backout.You must construct a valid table of data to write, one general ledger account per activity per record. Lusid.FundConfiguration.Writer
lists the fields (columns) available to populate with values for each record, and has a set of parameters to help you construct a valid table.
Your query can use the WriteAction
field to perform one of the following operations:
Upsert a module; that is, create a module if it does not exist, and update just its inlined properties if it does. Note you cannot currently update the core data fields of an existing module. This is the default operation if you omit
WriteAction
.Insert a new module.
Update just the inlined properties of an existing module.
Delete a module.
See also: Lusid.FundConfiguration
Basic usage
@table_of_data = <select-statement>;
select * from Lusid.FundConfiguration.Writer where toWrite = @table_of_data;
Query parameters
Lusid.FundConfiguration.Writer
has parameters that help you construct a valid table of data to write.
Note: The
ToWrite
parameter is mandatory and used to actually write the table of data into LUSID.
To list available parameters, their data types, default values, and an explanation for each, run the following query using a suitable tool:
select FieldName, DataType, ParamDefaultValue, Description from Sys.Field where TableName = 'Lusid.FundConfiguration.Writer' and FieldType = 'Parameter';
Data fields
Lusid.FundConfiguration.Writer
lists the fields you can populate in your table of data to write.
Depending on the operation you want to perform, the following fields are mandatory to include in the table of data:
Operation | Specify using... | Mandatory fields | Notes |
---|---|---|---|
Upsert |
|
|
|
Insert |
| ||
Update |
| You can only update inlined properties of an existing module, not core data fields. | |
Delete |
|
|
|
To list all available fields, their data types, whether fields are considered 'main', and an explanation for each, run the following query using a suitable tool:
select FieldName, DataType, IsMain, IsPrimaryKey, SampleValues, Description from Sys.Field where TableName = 'Lusid.FundConfiguration.Writer' and FieldType = 'Column';
Write errors
We recommend examining the results of every write query using one or more of the WriteError
, WriteErrorCode
and WriteErrorDetail
fields.
For each record in the table of data to write, Lusid.FundConfiguration.Writer
returns an error code. If the operation is successful, the error code is 0
. If unsuccessful, a positive error code and explanation help you discover why LUSID considers the operation invalid.
Examples
Note: For more example Luminesce SQL queries, visit our Github repo.
Example 1: Create a fund configuration module
In this example, two records identify general ledger accounts storing dealing activity and one record identifies an account storing P&L. You can specify any number of accounts for any activity.
@filters = values
('Dealing', 'Subs', 'generalLedgerAccountCode eq ''2-Subscriptions'''),
('Dealing', 'Reds', 'generalLedgerAccountCode eq ''3-Redemptions'''),
('Pnl', 'P&L', 'generalLedgerAccountCode eq ''4-Pnl''')
;
@data_to_write = select 'FundConfig' as FundConfigurationScope, 'Growth' as FundConfigurationCode,
'MyFundConfigModule' as DisplayName, column1 as FilterType, column2 as FilterId, column3 as [Filter] from @filters;
select * from Lusid.FundConfiguration.Writer where ToWrite = @data_to_write;
Example 2: Delete a fund configuration module
Specify 'Delete' as WriteAction
to delete a module.
@data_to_write = select 'FundConfig' as FundConfigurationScope, 'Growth' as FundConfigurationCode, 'Delete' as WriteAction;
select * from Lusid.FundConfiguration.Writer where ToWrite = @data_to_write;