Cognos Analytics

 View Only

 Help : Defining source overrides in Cognos Analytics (using macros)

Patrick Neveu's profile image
Patrick Neveu IBM Champion posted Wed May 21, 2025 10:01 AM

Hi,

I'm using source override feature in a data module. When I run a report, I'm prompted to select the correct datasource between 2 countries.

I would like to have only one datasource called DW and have multiple datasource connections such as DW_FRA, DW_ITA, and so on.

Most users will have access to only 1 country, so I would like to avoid a useless prompt.

My working prompt is the following for Set the override value for the data server connection:

#prompt('Datasource';'token';'';'';'CountryAccess.Datasource')# 

I've been trying to create a new syntax (it is not working at this time) with

case
when #queryValue ('count(CountryAccess.Datasource)')# = "1"
then #queryValue('CountryAccess.Datasource')#
else
#prompt('Datasource';'token';'DW_TMF_FRA';'';'CountryAccess.Datasource')#
end 

or with the same idea (still not working):

#CASE
WHEN queryValue ('count(CountryAccess.Datasource)') = "1"
THEN queryValue('max(CountryAccess.Datasource)')
ELSE
prompt('Datasource';'token';'DW_TMF_FRA';'';'CountryAccess.Datasource')
END#

Note: I have tried with 1, "1", '1', with and without sq, trying to use if then else instead of case-else-end.

Best regards,

Philipp Hornung's profile image
Philipp Hornung IBM Champion

Hi Patrick, I'm not sure if I got you right, but from my understanding it will be sufficient to restrict the user at a Data Source Connection level. Users with only one connection won't get the prompt then but e.g. administrators will. Best, Philipp