Type | Read/write | Author | Availability |
Write | FINBOURNE | Provided with LUSID |
Providing you have sufficient access control permissions, the Lusid.AccountingDiary.Writer
provider enables you to write a Luminesce SQL query that creates one or more accounting diary entries of type Other
to an ABOR in LUSID.
Note the following:
LUSID automatically creates diary entries of type
PeriodBoundary
when you close or lock a period. Note these are not operations you can perform using Luminesce.You can create diary entries of type
ValuationPoint
using the Lusid.Fund.ValuationPoint.Writer provider.You cannot currently use this provider to delete a diary entry of type
Other
.By default,
Lusid.AccountingDiary.Writer
cannot add properties to diary entries. To do this, you must first configureLusid.AccountingDiary.Writer
to 'inline' properties. See how to do this.
You must construct a valid table of data to write, one diary entry per record. Lusid.AccountingDiary.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. Note you cannot update an existing diary entry.
See also: Lusid.AccountingDiary
Basic usage
@table_of_data = <select-statement>;
select * from Lusid.AccountingDiary.Writer where toWrite = @table_of_data;
Query parameters
Lusid.AccountingDiary.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.AccountingDiary.Writer' and FieldType = 'Parameter';
Data fields
Lusid.AccountingDiary.Writer
lists the fields you can populate in your table of data to write. The following fields are mandatory:
Mandatory fields | Notes |
| The The |
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.AccountingDiary.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.AccountingDiary.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: Add a single diary entry
@data_to_write = select 'Abor' as AborScope, 'Standard' as AborCode, '2023_Q1' as DiaryEntryCode,
'Q1 2023' as Name, #2023-04-02# as EffectiveDate;
select * from Lusid.AccountingDiary.Writer where ToWrite = @data_to_write;
Example 2: Add multiple diary entries
@entries = values
('2023_Q1', 'Q1 2023', #2023-04-02#, #2023-04-15#),
('2023_Q2', 'Q2 2023', #2023-07-02#, #2023-07-15#),
('2023_Q3', 'Q3 2023', #2023-10-02#, #2023-10-15#)
;
@data_to_write = select 'Abor' as AborScope, 'Standard' as AborCode, column1 as DiaryEntryCode,
column2 as Name, column3 as EffectiveDate, column4 as QueryAsAt from @entries;
select * from Lusid.AccountingDiary.Writer where ToWrite = @data_to_write;