You can add one or more cleardown modules, each containing any number of cleardown rules, to an existing chart of accounts (CoA).
Note the order in which cleardown rules are specified in a module is significant. For each journal entry line, LUSID uses the first matching cleardown rule found to transfer balances in P&L accounts to other accounts at year end.
Methods
Call the CreateCleardownModule API, for example:
curl -X POST 'https://<your-domain>.lusid.com/api/api/chartofaccounts/CoAs/DailyCoA/cleardownmodules'
-H 'Content-Type: application/json-patch+json'
-H 'Authorization: Bearer <your-API-access-token>'
-d '{
"code": "EoY",
"displayName": "End of year cleardown module",
"description": "This is a cleardown module for end of year",
"rules": [
{
"ruleId": "rule_0001",
"generalLedgerAccountCode": "1-Investments",
"ruleFilter": "Account.Code startswith '200'"
},
{
"ruleId": "rule_0002",
"generalLedgerAccountCode": "2-Cash",
"ruleFilter": "Account.Type in 'Income','Expense','Revenue'"
},
{
"ruleId": "rule_0003",
"generalLedgerAccountCode": "3-Subscriptions",
"ruleFilter": "Properties[Account/MyScope/Cleardown] exists and Properties[Fund/MyScope/Region] eq 'EMEA'"
}
]
}'
Navigate to Fund Accounting > Chart of Accounts, open the Cleardown Modules tab, select the parent CoA and click the Create cleardown module button.
You can either add cleardown rules to the module using the Add button in this dialog, or alternatively navigate to the Cleardown Rules tab.
Write a Luminesce SQL query using the Lusid.CleardownModule.Writer provider to create a cleardown module and the Lusid.CleardownModule.Rule.Writer provider to set cleardown rules, and execute it using a tool such as the LUSID web app, for example:
Data fields
This section supplements the API documentation and on-screen help text in the LUSID web app.
A cleardown module is identified by a code
that must be unique within the parent CoA.
You can specify any number of cleardown rules. Note the order is significant. Each cleardown rule consists of:
A
ruleId
that uniquely identifies the cleardown rule in the cleardown module.A
generalLedgerAccountCode
to transfer the credit or debit amount to.A
ruleFilter
defining the rule. Syntax and allowed values.
Subsequent updates
Once created, you can edit an existing cleardown module as follows:
To change the
displayName
ordescription
of the module, call the SetCleardownModuleDetails API. You cannot change thecode
.To change the order of existing rules in the module, call the SetCleardownModuleRules API. Note you must specify all the rules again, this time in the required order; any omitted from the request are removed.
To insert one or more new cleardown rules at a specific order, call the PatchCleardownModule API. For example, the following request adds a new rule as the second in the list (the index starts at 0):
curl -X PATCH 'https://<your-domain>.lusid.com/api/api/chartofaccounts/CoAs/DailyCoA/cleardownmodules/EoY' -H 'Content-Type: application/json-patch+json' -H 'Authorization: Bearer <your-API-access-token>' -d '[ { "value": { "ruleId": "rule_0001a", "generalLedgerAccountCode": "Error", "ruleFilter": "EconomicBucket eq 'PL_Other'" }, "path": "/rules/1", "op": "add" } ]'
To add a new rule as the first in the list, specify a
path
of/rules/0
. To add a new rule last, specify/rules/-
. LUSID automatically moves the index position of other rules.To delete a cleardown module, call the DeleteCleardownModule API.
Note it may be easier to change the order of cleardown rules in the LUSID web app using the ‘grab handles’ (in yellow) or up/down arrows (in red):
Syntax of a cleardown rule
The syntax of a ruleFilter
expression in a cleardown rule is:
<attribute> <operator> <value>
...where:
<attribute>
and<value>
are explained in the table below.<operator>
is one of the LUSID filter operators.
Note the following:
A
ruleFilter
expression is case-insensitive.A string
<value>
must be enclosed in single straight quote marks (the%27
UTF-8 encoding).You can concatenate expressions using the
and
andor
operators. If you use both, standard boolean operator precedence applies.
| Data type | Example expression | Explanation/origin of |
---|---|---|---|
An account field | System-defined |
| This can be any of the stored fields for an account, prefixed by |
An account property | User-defined |
| This can be any property with a 3-stage key in the |
A fund property | User-defined |
| This can be any property with a 3-stage key in the |
An ABOR property (V1 funds only) | User-defined |
| This can be any property with a 3-stage key in the |