Type | Read/write | Author | Availability |
Write | FINBOURNE | Provided with LUSID |
Providing you have sufficient access control permissions, the Lusid.Abor.Writer
provider enables you to write a Luminesce SQL query that either creates or deletes ABOR entities in LUSID.
Note: By default,
Lusid.Abor.Writer
cannot add properties to ABORs. To do this, you must first configureLusid.Abor.Writer
to 'inline' properties. See how to do this.
An ABOR must reference at least one transaction portfolio. You must construct a valid table of data to write, one record per portfolio per ABOR. Lusid.Abor.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 an ABOR; that is, create one if it does not already exist, and update just inlined properties if it does. Note it is not currently possible to update the core data fields of an existing ABOR. Note also if the ABOR references more than one portfolio, you must specify one record per portfolio. This is the default operation if you omit
WriteAction
.Delete an ABOR.
Once you have created an ABOR, you can create a trial balance for that ABOR.
See also: Lusid.Abor
Basic usage
@table_of_data = <select-statement>;
select * from Lusid.Abor.Writer where toWrite = @table_of_data;
Query parameters
Lusid.Abor.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.Abor.Writer' and FieldType = 'Parameter';
Data fields
Lusid.Abor.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 |
|
| When creating a new ABOR, you can only specify one portfolio using the When updating an existing ABOR, core data fields are ignored. You can only update inlined properties. |
Insert |
|
| |
Update |
| You can only update inlined properties of an existing ABOR, not any of the 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.Abor.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.Abor.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 an ABOR referencing a single portfolio
Upsert is the default operation if you omit the WriteAction
field.
@data_to_write = select 'Abor' as AborScope, 'DailyNAV' as AborCode, 'DailyNAV' as DisplayName, 'Abor' as AborConfigurationScope,
'Standard' as AborConfigurationCode, 'Finbourne-Examples' as PortfolioScope, 'UK-Equities' as PortfolioCode;
select * from Lusid.Abor.Writer where ToWrite = @data_to_write;
Example 2: Create an ABOR referencing multiple portfolios
To reference multiple portfolios, specify one record per portfolio, with all the field values except PortfolioCode
(and potentially PortfolioScope
) the same.
@@scope = select 'Abor';
@portfolios = values
('UK-Equities'),
('Global-Equities'),
('FixedIncome')
;
@data_to_write = select @@scope as AborScope, 'DailyNAV' as AborCode, 'DailyNAV' as DisplayName, @@scope as AborConfigurationScope,
'Standard' as AborConfigurationCode, 'Finbourne-Examples' as PortfolioScope, column1 as PortfolioCode from @portfolios;
select * from Lusid.Abor.Writer where ToWrite = @data_to_write;
Example 3: Create multiple ABORS referencing a single portfolio each
@@scope = select 'Abor';
@abors = values
('DailyNAV', 'ABOR for daily NAV'),
('EoYNAV', 'ABOR for end of year NAV'),
('QNav', 'ABOR for quarterly NAV')
;
@data_to_write = select @@scope as AborScope, column1 as AborCode, @@scope as AborConfigurationScope, 'Standard' as AborConfigurationCode,
'Finbourne-Examples' as PortfolioScope, 'UK-Equities' as PortfolioCode, column2 as DisplayName from @abors;
select * from Lusid.Abor.Writer where ToWrite = @data_to_write;
Example 4: Create multiple ABORs referencing multiple portfolios each
@@scope = select 'Abor';
@portfolios = values
('UK-Equities'),
('Global-Equities')
;
@abors = values
('DailyNAV', 'ABOR for daily NAV'),
('EoYNAV', 'ABOR for end of year NAV'),
('QNav', 'ABOR for quarterly NAV')
;
@data_to_write = select
@@scope as AborScope,
a.Column1 as AborCode,
a.Column2 as DisplayName,
@@scope as PortfolioScope,
p.Column1 as PortfolioCode,
@@scope as AborConfigurationScope,
'Standard' as AborConfigurationCode
from @abors a
cross join @portfolios p
;
select * from Lusid.Abor.Writer where ToWrite = @data_to_write;
Example 5: Delete an ABOR
@data_to_write = select 'Abor' as AborScope, 'DailyNAV' as AborCode, 'Delete' as WriteAction;
select * from Lusid.Abor.Writer where ToWrite = @data_to_write;