Cognos Analytics

 View Only

 Query items getting deleted from model causing reports to fail

Mack L's profile image
Mack L posted Tue October 28, 2025 07:50 AM

Hi,

I am having a issue where query items are getting deleted from the metadata models causing reports to fail.

How this happens:

1) A Cognos report fails in production with an error that indicates one or more query items in the report are missing

2) I trace the problem to the model and find that the the particular query items are missing in query subject in the Data Source Layer

3) I update the data source query subject to restore the query items which got deleted.

4) I recreate the query item references in the relevant model query subject and republish the package to get the affected reports running again.

Observation: data fields are temporarily disappearing (probably refresh issues of views) in the source database causing the references in metadata model to get deleted in the datasource layer and modelling layer. On updating the particular query subject and republishing the model, the issue is resolved but this has been happening a few times now.

The models are using views from the data source. Is there a way to resolve this without having to go over the above steps again and again?

Paul Mendelson's profile image
Paul Mendelson IBM Champion

This sounds weird. Is this a framework model or a data module? When you say package, it sounds like you're using Framework Manager, so something else must be at play here. The models don't update themselves to remove data items it can't find in the data source. The database (not Cognos) would return an error that the field is missing from the view - Cognos would just generate the query as normal. Next time this happens, can you copy the error and also check the last time the package was published?

Mack L's profile image
Mack L

Hi Paul,

Thank you for the suggestion. Yes, I should have saved the error and will have to check when the package was last published.

My assumption was that data items were getting temporarily excluded from views in the Database used by reports causing the references to get deleted in the FM model.

John Cusack's profile image
John Cusack

Hi Mack,

As Paul has mentioned, Cognos does not "change the model after it is published".  Cognos is only reporting to you and the user that the field can't be located in the database.  I believe what is happening is, you are digging into the model to determine what is happening and by doing so, you are unintentionally updating the meta data associated to the query subject (QS).  Typically your lowest level QS is going to be a SELECT * FROM TABLE_ABC.  By editing that QS, FM does a DB call to get the latest list of meta data for the table.  If the table/view has a few fields missing, that list coming back is going to have a few fields missing as well. Instead of editing the QS, right click on it and choose Test - this should attempt to retrieve the original meta data list because it doesn't know any better.  It only knows when you get into edit mode.

If this happens again, find the view that needs fixed by however you go about that (editing the QS and so forth) but after you fix the view -- close the model (DO NOT SAVE IT) - reopen the model and test the QS with the restored view.  Assuming the view was restored to its original state, the error should disappear.  As a final test, go to the report that was giving the error and see if the error pops up.

Instead of waiting until the next time -- do a quick test on your own -- in DEV/UAT - create a view called "testing" - add it to your FM Model - publish a testing package.  Create a report from the testing package.  Modify the view on the database by removing a field or two. RUn the test report and get the error.  Go into FM and see how the meta data is updated but close it out without saving or republishing the test package.  Modify the view back to its original state -- your report should run without error.  This will hopefully show you that Cognos isn't modifying your package/model at run-time.     

Hope that is helpful.  

Mack L's profile image
Mack L

Hi @John Cusack,

@Paul Mendelson

    I did the test that John suggested and found that yes, the model does not automatically delete references to data items in Database views when the data item is deleted in the view. Also, it is true what Paul mentioned that it should throw a database error rather than a Cognos model error. In my case it is throwing an Expression parsing Error and when I look at the details under the error, it indicates that the particular model items mapped to the corresponding report items are missing.

The issue remains unresolved as a couple of days back I faced it again with another report failing due to the same reason. I found that a data source query subject in the model was missing a few query items (interestingly the corresponding model query subject was also missing the references to those query items). Another observation was that the particular data source query subject had not been updated for a long time (years), so I am surprised that it was missing the items and the corresponding report failed and after fixing the issue by updating the query subjects (the query used in the datasource query subject is a 'Select * from ....) and re-publising the package, subsequently another report from the same package failed indicating that when I republished the package, the model got updated with another deletion of items from another query subject causing the new report failure. 

I thought it could be temporary dropping of columns in the views of development Database instance that could be causing this but on checking with DB team, found that it is not possible. I am still trying to resolve this.

So far reports have failed due to the above issue a number of times this year.