Type | Read/write | Author | Availability |
|---|---|---|---|
Read | FINBOURNE | Provided with LUSID |
The Lusid.ComplianceRuleResult provider enables you to write a Luminesce SQL query that retrieves the outcome of a compliance run, one row per rule.
To understand why a rule result shows as Failed or Warning, for example which instrument or property caused it, use Lusid.ComplianceRuleResult.Breakdown.
Note
The LUSID user running the query must have sufficient access control permissions to both use the provider and read compliance data. This should automatically be the case if you are the domain owner.
See also: Lusid.RunCompliance, Lusid.ComplianceRule, Lusid.ComplianceRuleResult.Breakdown
Basic usage
select * from Lusid.ComplianceRuleResult where <filter-expression>Query parameters
Lusid.ComplianceRuleResult has parameters that enable you to filter or refine a query.
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.ComplianceRuleResult' and FieldType = 'Parameter';Data fields
By default, Lusid.ComplianceRuleResult returns a table of data populated with particular fields (columns). You can return a subset of these fields.
To list fields available to return, 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, SampleValues, Description from Sys.Field where TableName = 'Lusid.ComplianceRuleResult' and FieldType = 'Column';Note
Fields marked 'main' are returned by queries that include a caret character, for example
select ^ from Lusid.ComplianceRuleResult.
Examples
Note
For more example Luminesce SQL queries, visit our Github repo.
Example 1: Retrieve all rule results for a compliance run
select * from Lusid.ComplianceRuleResult
where RunScope = 'PMS'
and RunCode = 'bbbcfccd-d773-4a30-b478-d5bb9e34363e';Example 2: Retrieve only the rules that did not pass
select * from Lusid.ComplianceRuleResult
where RunScope = 'PMS'
and RunCode = 'bbbcfccd-d773-4a30-b478-d5bb9e34363e'
and RuleStatus != 'Passed';Example 3: Retrieve the results for a particular rule from a run
select * from Lusid.ComplianceRuleResult
where RunScope = 'PMS'
and RunCode = 'bbbcfccd-d773-4a30-b478-d5bb9e34363e'
and ComplianceRuleScope = 'PMS'
and ComplianceRuleCode = 'instrument-permitted-domicile';Example 4: Join a rule result with its breakdown for more details
@@RunScope = select 'PMS';
@@RunCode = select 'bbbcfccd-d773-4a30-b478-d5bb9e34363e';
@RuleResult = select * from Lusid.ComplianceRuleResult
where RunScope = @@RunScope
and RunCode = @@RunCode
and ComplianceRuleScope = 'PMS'
and ComplianceRuleCode = 'instrument-permitted-domicile';
@Breakdown = use Lusid.ComplianceRuleResult.Breakdown with @@RunScope, @@RunCode
--runScope={@@RunScope}
--runCode={@@RunCode}
enduse;
select
rr.ComplianceRuleScope,
rr.ComplianceRuleCode,
rr.RuleStatus,
rr.ErrorDetail,
bd.*
from @RuleResult rr
inner join @Breakdown bd
on rr.ComplianceRuleCode = bd.ComplianceRuleCode;