If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Macro to change Databases

Started by cognostechie, 07 Jul 2025 03:02:09 PM

Previous topic - Next topic

cognostechie

I swear I have done this before and it used to work but somehow in ver 11.2 it doesn't work.

I want to change the Database depending on which Database the user wants to connect to so I created two Data Sources in Cognos and reports are working from both. Now I created a Model Query subject with two columns.

1> DS_ID  - Value is '1'
2> DS_NAME - CASE
    WHEN #prompt('Type NewDB or LegacyDB','string')#  = 'LegacyDB' THEN 'LEGACYDB'
    ELSE 'NEWDB'
  END

LEGACY and NEWDB are the Data Sources in Cognos.

I created a Parameter Map with the name DS_NAME and pointed that to the Model Query Subject. DS_ID as the Key and DS_NAME as the Value.

In the Data Source , property - Content Manager Datasource - I am putting this #$[DS_NAME]{'DS_ID'}#

It gives an error 'QE-DEF-0286 Unable to find the connection #$[DS_NAME]{'DS_ID'}# in the Content Store'

What am I doing wrong?

bus_pass_man

I'm assuming that you consciously made the decision to not put the macro into the data source connection property and, instead, pursue this approach. Could you explain why that method was not suitable please. 

cognostechie

I don't exactly know what you mean by Data Source connection property. Are you referring to the connection of the Data Source in Cognos admin page or Data Source properties in FM? Both are different things. The Data Source object in FM is a local Data Source embedded inside the xml file which connects to the actual Data Source using the properties defined.

It is working now. The problem was the model was brand new so it was using DQM mode. It doesn't work in DQM models. When I made a CQM model, it worked. To double check it, I also converted the new DQM model to CQM and it worked! Seems like they disabled it for DQM models.

bus_pass_man