Views:
TypeRead/writeAuthorAvailability
Data providerWriteFINBOURNEProvided with LUSID

Providing you have sufficient access control permissions, the Notification.ManualEvent.Writer provider enables you to write a Luminesce SQL query that triggers one or more manual events in LUSID's Notification Service.

You must construct a valid table of data to write, one manual event per record. Notification.ManualEvent.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.

See also: Notification.Subscription

Basic usage

@table_of_data = <select-statement>;
select * from Notification.ManualEvent.Writer where toWrite = @table_of_data;

Query parameters

Notification.ManualEvent.Writer has parameters that help you construct a valid table of data to write.

Note: The ToWrite parameter is mandatory and describes the data for the manual events you are triggering.

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 = 'Notification.ManualEvent.Writer' and FieldType = 'Parameter';

Data fields

Notification.ManualEvent.Writer lists the fields you can populate in your table of data to write.

The following fields are mandatory to include in the table of data:

  • Message
  • Subject

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 = 'Notification.ManualEvent.Writer' and FieldType = 'Column';

Write errors

We recommend examining the results of every write query using the WriteError field.

For each record in the table of data, if unsuccessful, Notification.ManualEvent.Writer returns a WriteError message containing an error code and explanation to help you discover why LUSID considers the operation invalid. 

Examples

Note: For more example Luminesce SQL queries, visit our Github repo.

Example 1: Trigger a manual event

@data_to_write = select 
'A new corporate action has been announced' as Message, 
'New Corporate Action Announced' as Subject,
'
  {
     "AnnouncementDate": "2023-02-13",
     "Company": "Apple",
     "CorporateAction": "Cash dividend"
  }
' as JsonMessage;
select * from Notification.ManualEvent.Writer where ToWrite = @data_to_write;

Example 2: Trigger multiple manual events with the same subject and message

@@message = select 'A new corporate action has been announced';
@@subject = select 'New Corporate Action Announced';

@announcements = values
('{
    "AnnouncementDate": "2023-02-15",
    "Company": "Microsoft",
    "CorporateAction": "Stock split" 
}'),
('{
    "AnnouncementDate": "2023-02-17",
    "Company": "BP",
    "CorporateAction": "Reverse stock split"
}');

@data_to_write = select @@message as Message, @@subject as Subject, column1 as JsonMessage from @announcements;
select * from Notification.ManualEvent.Writer where ToWrite = @data_to_write;