---
title: "Lusid.FundConfiguration.Writer"
slug: "lusidfundconfigurationwriter"
updated: 2024-10-11T11:22:52Z
published: 2024-10-11T11:22:52Z
canonical: "support.lusid.com/lusidfundconfigurationwriter"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://support.lusid.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Lusid.FundConfiguration.Writer

| **Type** | **Read/write** | **Author** | **Availability** |
| --- | --- | --- | --- |
| [Data provider](/v1/docs/what-are-a-data-provider-and-a-direct-provider) | Write | FINBOURNE | Provided with LUSID |

Providing you have sufficient [access control permissions](/v1/docs/creating-policies-to-control-access-to-providers-for-different-luminesce-end-users), the `Lusid.FundConfiguration.Writer` provider enables you to write a [Luminesce SQL query](/v1/docs/understanding-the-luminesce-sql-query-syntax) that creates, updates or deletes [fund configuration modules](/v1/docs/how-do-i-create-a-fund-configuration-module) in LUSID.

> **Note**: By default, `Lusid.FundConfiguration.Writer` cannot add properties to modules. To do this, you must first configure `Lusid.FundConfiguration.Writer` to 'inline' properties. [See how to do this](/v1/docs/how-do-i-configure-luminesce-entity-providers-to-readwrite-properties).

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](/v1/docs/lusidfundconfiguration)

## Basic usage

```sql
@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](/v1/docs/what-tools-are-available-to-write-luminesce-queries):

```sql
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 | `'Upsert' as WriteAction` (or omit) | `FundConfigurationScope` `FundConfigurationCode` `DisplayName` | - The `FilterType` field must be either `Dealing`, `Pnl` or `BackOut`. - The `FilterId` field can be any intuitive string unique to the `FilterType`. - For information on the syntax of `Filter` field expressions, see [this article](https://support.lusid.com/docs/how-do-i-create-a-fund-configuration-module#syntax-and-allowed-values). Note each `'` character encapsulating a string value must be escaped by an additional `'` character in Luminesce, so for example `select 'generalLedgerAccountCode eq ''4-Pnl''' as [Filter]`. - Note you can only update inlined properties of an existing module, not core data fields. |
| Insert | `'Insert' as WriteAction` |  |
| Update | `'Update' as WriteAction` | You can only update inlined properties of an existing module, not core data fields. |
| Delete | `'Delete' as WriteAction` | `FundConfigurationScope` `FundConfigurationCode` |  |

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](/v1/docs/what-tools-are-available-to-write-luminesce-queries):

```sql
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](https://github.com/finbourne/luminesce-examples/tree/master/examples/lusid/abor).

### 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.

```sql
@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.

```sql
@data_to_write = select 'FundConfig' as FundConfigurationScope, 'Growth' as FundConfigurationCode, 'Delete' as WriteAction;
select * from Lusid.FundConfiguration.Writer where ToWrite = @data_to_write;
```
