Views:
TypeRead/writeAuthorAvailability
Data providerWriteFINBOURNEProvided with LUSID

Providing you have sufficient access control permissions, the Lusid.AccountingDiary.Writer provider enables you to write a Luminesce SQL query that adds one or more accounting diary entries to an ABOR in LUSID.

Note the following:

  • LUSID automatically creates accounting diary entries when you close or lock a period. This might be more convenient than creating your own.
  • By default, Lusid.AccountingDiary.Writer cannot add properties to accounting diary entries. To do this, you must first configure Lusid.AccountingDiary.Writer to 'inline' properties. See how to do this.

You must construct a valid table of data to write, one accounting 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 accounting 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 fieldsNotes
AborScope
AborCode
DiaryEntryCode
Name
EffectiveDate

The DiaryEntryCode must be unique among all accounting diary entries for a particular ABOR.

The QueryAsAt field is optional and defaults to the current datetime.

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 WriteErrorWriteErrorCode 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 accounting 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 accounting 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;