CAST Engineering Dashboard - Quality rule - Incorrect Total Checks
Purpose (problem description)
In the diagnostic detail page, the Total count provided in the summary table is not as expected by customer.
Applicable in CAST Version
| Release | Yes/No |
|---|---|
| 8.3.x | ✅ |
Observed on RDBMS
| RDBMS | Yes/No |
|---|---|
| CSS | ✅ |
Action Plan
- Execute the total procedure by following the steps mentioned in the page SQL Queries - CAST Knowledge Base - Queries on metrics and diagnostics - How to run DETAIL and TOTAL procedures manually
- If the value returned by the manual execution is different than the value displayed under CED, then identify and execute manually the SQL query involved in the display CAST Engineering Dashboard - Information - How to identify and execute SQL query involved in data display and contact CAST Technical Support with the query results and Relevant input
- Else If the value returned by the manual execution is equal to the value displayed under CED
- If the total check value from the manual execution is greater than the expected value of the total Check:
Check if the objects involved in the total check are shared between several Analysis Units. For that run the following query on the central schema
- If the total check value from the manual execution is greater than the expected value of the total Check:
select dso.object_id, dso.object_name, dso.object_full_name
from DSS_OBJECTS dso
join ( select R.SNAPSHOT_ID,
R.OBJECT_ID,
count(distinct DLIM.PREVIOUS_OBJECT_ID) as SHARING_FACTOR,
count(distinct DLI.PREVIOUS_OBJECT_ID) as T_SHARING_FACTOR
from DSS_METRIC_TYPES T
join DSS_METRIC_HISTO_TREE HT
on HT.METRIC_ID = T.METRIC_ID
and T.METRIC_GROUP = 1
– and HT.METRIC_CRITICAL = 1
join DSS_METRIC_RESULTS R
on R.METRIC_ID = HT.METRIC_ID + 1
and R.METRIC_VALUE_INDEX = 1
and R.SNAPSHOT_ID = HT.SNAPSHOT_ID
join DSS_LINK_INFO DLI
on DLI.SNAPSHOT_ID = HT.SNAPSHOT_ID
and DLI.LINK_TYPE_ID = 3
and DLI.NEXT_OBJECT_ID = R.OBJECT_ID
join DSS_LINK_INFO DLIM
on DLIM.SNAPSHOT_ID = HT.SNAPSHOT_ID
and DLIM.LINK_TYPE_ID = 1
and DLIM.NEXT_OBJECT_ID = DLI.PREVIOUS_OBJECT_ID
join DSS_OBJECTS dsom
on dsom.OBJECT_ID = dlim.PREVIOUS_OBJECT_ID
and dsom.OBJECT_TYPE_ID = 20000
and dsom.OBJECT_NAME not like ‘%union_content%’
join DSS_OBJECTS dsot
on dsot.OBJECT_ID = dli.PREVIOUS_OBJECT_ID
where R.SNAPSHOT_ID = <Snapshot_id>
and T.METRIC_Id = <Metric_id>
group by R.SNAPSHOT_ID, R.OBJECT_ID
) T
on T.OBJECT_ID = dso.OBJECT_ID
where T.SHARING_FACTOR > 1
or T.T_SHARING_FACTOR > 1
Replace the metric\_id with the metric Id of the Quality rule and the snapshot\_id with the snapshot id from where the issue is observed. For the Quality rule [Avoid using "SELECT DISTINCT", use DELETE-ADJACENT](http://doc.castsoftware.com/pages/viewpage.action?pageId=228102548), the metric\_id is equal to 7594:
Following is a query result sample
**Query result example**
113422;"web.xml";"[S:\Sources\PPIT\Java\IdentityService\service\src\main\webapp\WEB-INF\web.xml]"
**Query result interpretation**
The query returns the object id, object\_name and object full name
If the query returns rows then there is Shared objects between Analysis units, the query returns the list of Shared objects
1. Examine the configuration path of the Analysis Units and check if there is an Overlapping between paths, for more information refer to [CMS - Analysis Unit editor](https://doc-legacy.castsoftware.com/display/DOC83/CMS+-+Analysis+Unit+editor)

2. Check if the Shared objects are part of the overlapped Analysis Units by Viewing Analysis Unit content, for more information refer to [CMS - Analysis Unit editor](https://doc-legacy.castsoftware.com/display/DOC83/CMS+-+Analysis+Unit+editor). you can use the following page to get the list of objects belonging to an analysis unit - [SQL Queries - CAST Knowledge Base - Queries on objects - What is the Analysis Unit of an object or list of objects](https://doc-legacy.castsoftware.com/display/TKBQG/SQL+Queries+-+CAST+Knowledge+Base+-+Queries+on+objects+-+What+is+the+Analysis+Unit+of+an+object+or+list+of+objects)
1. If the Shared objects are part of the overlapped Analysis Units:
1. 1. If the Analysis Units were configured manually, then this is an expected behavior.
2. Else if the Analysis Units were discovered by the DMT then refer to [Delivery Manager Tool Component DMT](https://doc-legacy.castsoftware.com/display/TKBQG/Delivery+Manager+Tool+Component+DMT)
2. Else If the Shared objects are not part of the overlapped Analysis Units, then there is an issue with the Analysis Units creation, for further investigation refer to [CMS Analysis Unit - Analysis Units creation](https://doc-legacy.castsoftware.com/display/TKBQG/CMS+Analysis+Unit+-+Analysis+Units+creation)
2. Else If the total check value from the manual execution is lower than the expected value of the total Check:
1. Get the list of objects counted in the total checks
2. Run the TOTAL procedures manually on the knowledge schema by following the page [SQL Queries - CAST Knowledge Base - Queries on metrics and diagnostics - How to run DETAIL and TOTAL procedures manually](https://doc-legacy.castsoftware.com/display/TKBQG/SQL+Queries+-+CAST+Knowledge+Base+-+Queries+on+metrics+and+diagnostics+-+How+to+run+DETAIL+and+TOTAL+procedures+manually)
3. Identify the sub-query or condition of the procedure responsible for getting (depending on your initial observation) objects more or less than expected, You can proceed per identification by executing sub parts of the procedure.
If we take the example of the Quality rule [Avoid using "SELECT DISTINCT", use DELETE-ADJACENT](http://doc.castsoftware.com/pages/viewpage.action?pageId=228102548) that have the following TOTAL procedure:
```sql
CREATE OR REPLACE FUNCTION DIAG_ABAP_ANA_ARTIF_T_TOTAL
(
I_SNAPSHOT_ID IN INT,
- the metric SNAPSHOT id I_METRIC_PARENT_ID IN INT,
- the metric parent id I_METRIC_ID IN INT,
- the metric id I_METRIC_VALUE_INDEX IN INT
)
RETURN INT
IS
ERRORCODE INT := 0;
BEGIN
--<<NAME>>DIAG_ABAP_ANA_ARTIF_T_TOTAL<</NAME>>*/
--<<COMMENT>> Template name = DSSGENERICTOTAL. <</COMMENT>>
--<<COMMENT>> Definition = Number of ABAP Artifacts with OpenSQL queries. <</COMMENT>>
INSERT
INTO DSS_METRIC_RESULTS
(
METRIC_NUM_VALUE ,
METRIC_OBJECT_ID ,
OBJECT_ID ,
METRIC_ID ,
METRIC_VALUE_INDEX,
SNAPSHOT_ID
)
SELECT COUNT( T1.OBJECT_ID),
0 ,
SC.OBJECT_PARENT_ID ,
I_METRIC_ID ,
I_METRIC_VALUE_INDEX,
I_SNAPSHOT_ID
FROM ObjInf T2 ,
DSSAPP_ARTIFACTS T1,
DSSAPP_MODULES MO ,
DSS_METRIC_SCOPES SC
WHERE SC.SNAPSHOT_ID = I_SNAPSHOT_ID
AND SC.METRIC_PARENT_ID = I_METRIC_PARENT_ID
AND SC.METRIC_ID = I_METRIC_ID
AND SC.COMPUTE_VALUE = 0
AND MO.TECHNO_TYPE = -15 - Technologic ABAP object
AND MO.MODULE_ID = SC.OBJECT_ID
AND T1.APPLICATION_ID = SC.OBJECT_ID
AND NOT EXISTS
( SELECT 1
FROM DSS_OBJECT_EXCEPTIONS E
WHERE E.METRIC_ID = I_METRIC_ID
AND E.OBJECT_ID = T1.OBJECT_ID
)
- OPEN SQL
AND T1.OBJECT_ID = T2.IdObj
AND T2.InfTyp = 9
AND T2.InfSubTyp = 1538
AND T2.InfVal > 0
GROUP BY SC.OBJECT_PARENT_ID,
SC.OBJECT_ID ;
RETURN ERRORCODE;
END DIAG_ABAP_ANA_ARTIF_T_TOTAL;
a condition can be the following condition:
```
AND T2.InfTyp = 9
4. If the identified sub query involves the table **ObjInf** with the condition **InfTyp = 9**, then the issue occurred under the Metric Calculation, If so refer to the following page for further investigation [CMS Snapshot analysis - Run Metrics Calculation](https://doc-legacy.castsoftware.com/display/TKBQG/CMS+Snapshot+analysis+-+Run+Metrics+Calculation)
5. Else if the identified sub query involves the table **ObjInf** with a condition different then **InfTyp = 9**, then the issue occurred under the Analyzer, If so refer to the following page for further investigation [CMS Snapshot Analysis - Run Analyzer](https://doc-legacy.castsoftware.com/display/TKBQG/CMS+Snapshot+Analysis+-+Run+Analyzer)
6. Else the issue occurred during Compute Snapshot then refer [CMS Snapshot Analysis - Compute Snapshot](https://doc-legacy.castsoftware.com/display/TKBQG/CMS+Snapshot+Analysis+-+Compute+Snapshot)
4. If the above steps do not solve your issue contact [CAST Technical Support](https://help.castsoftware.com/hc/en-us/requests/new). with the following [Relevant input](/export-v2/tg/technical-guides/technical-guides-by-cast-aip-component/cast-engineering-dashboard-component-ced/cast-engineering-dashboard-quality-rule/)
**Notes/comments**
**Related Pages**