Suppression Examples
In the use case that a query must be executed with an open-ended SQL clause to obtain the correct values, Aras Innovator provides the option to explicitly suppress the Item Analysis for such queries.
To generate a Suppression, an Administrator must create an ItemAnalysis.Suppressions.*.xml file in the \Innovator\Server\App_Data folder, such as \Innovator\Server\App_Data\ItemAnalysis.Suppressions.MyCustom.xml. There can be multiple ItemAnalysis.Suppressions.*.xml files, each with their own unique set of Suppressions.
The format of the ItemAnalysis.Suppessions.*.xml file is as follows:
<itemAnalysis>
<suppressions>
<!-- Suppression Parameters -->
</suppressions>
</itemAnalysis>
The Suppressions support @Parameter and @ParametersList as variables, which correspond with a SQL Constant and a SQL Constants List, respectively.
Examples of Suppression declarations are listed in the following sections.
Where Attribute Suppression Example
For each Where Attribute that needs to be suppressed, you must add a <whereAttribute> node.
The following is an example of a <whereAttribute> node in the ItemAnalysis.Suppressions file:
<whereAttribute>
<template><![CDATA[[Part].id IN (SELECT id FROM [PART] WHERE cost = @Parameter)]]></template>
</whereAttribute>
With this node, the following AML sent from a client will successfully pass the validation:
<AML>
<Item action="get" type="Part" where="[Part].id IN (SELECT id FROM [PART] WHERE cost = 5)"/>
</AML>
Condition In Attribute Suppression Example
For each Condition In Attribute that needs to be suppressed, you must add a <conditionInProperty> node.
The following is an example of a <conditionInProperty> node in the ItemAnalysis.Suppressions file:
<conditionInProperty>
<template><![CDATA[(SELECT cost FROM [innovator].[PART] WHERE [item_number] IN (@ParametersList))]]></template>
</conditionInProperty>
With this node, the following AML sent from a client will successfully pass the validation:
<Item action="get" type="Part">
<cost condition="in">(SELECT cost FROM [innovator].[PART] WHERE [item_number] IN ('A', 'C', 'D'))</cost>
</Item>
Condition Between Attribute Suppression
For each Condition Between Attribute that needs to be suppressed, you must add a <conditionBetweenProperty> node.
The following is an example of a <conditionBetweenProperty> node in the ItemAnalysis.Suppressions file:
<conditionBetweenProperty>
<template><![CDATA[(SELECT cost FROM [innovator].[PART] WHERE [item_number] = @Parameter) and (SELECT cost FROM [innovator].[PART] WHERE [item_number] = @Parameter)]]></template>
</conditionBetweenProperty>
With this node, the following AML sent from a client will successfully pass the validation:
<Item action="get" type="Part">
<cost condition="between">(SELECT cost FROM [innovator].[PART] WHERE [item_number] = 'B') and (SELECT cost FROM [innovator].[PART] WHERE [item_number] = 'D')</cost>
</Item>
As many Suppressions as required can be added to a single ItemAnalysis.Suppressions file. To add additional Suppressions, a second node of the required values must be added. An example of multiple Suppressions in a single file is included below:
<itemAnalysis>
<suppressions>
<whereAttribute>
<template><![CDATA[[Part].id IN (SELECT id FROM [PART] WHERE description = @Parameter)]]></template>
</whereAttribute>
<whereAttribute>
<template><![CDATA[[Part].id IN (SELECT id FROM [PART] WHERE cost > @Parameter)]]></template>
</whereAttribute>
<conditionInProperty>
<template><![CDATA[(SELECT cost FROM [innovator].[PART] WHERE [item_number] IN (@ParametersList))]]></template>
</conditionInProperty>
...
</suppressions>
</itemAnalysis>
As demonstrated, however, the Suppressions that are defined in the ItemAnalysis.Suppressions file are explicit in their interpretation. If an AML sent from a client does not pass the ItemAnalysis or match the Suppression precisely, the AML will be rejected.
As an example, given the original <whereAttribute> Suppression node:
<whereAttribute>
<template><![CDATA[[Part].id IN (SELECT id FROM [PART] WHERE cost = @Parameter)]]></template>
</whereAttribute>
The following query will succeed:
<AML>
<Item action="get" type="Part" where="[Part].id IN (SELECT id FROM [PART] WHERE cost = 5)"/>
</AML>
While the following query will throw an Item Analysis Error:
<AML>
<Item action="get" type="Part" where="[Part].id IN (SELECT id FROM [PART] WHERE cost > 5)"/>
</AML>
In order for the second query to succeed, an additional <whereAttribute> node must be added to an ItemAnalysis.Suppressions file.