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

[Solved] Add Connection Name to Report Header

Started by Cape Cod Gunny, 02 Dec 2019 12:59:39 PM

Previous topic - Next topic

Cape Cod Gunny

I have several End of Month database snapshots associated with the same Package. When a user runs a report it requires them to choose which Connection Name to use. I would like to include the "Connection Name" in the report header.

I've looked at all the "Layout Calculation" Report Expression Functions and did not see how to include the "Connection Name".

How do you include the "Connection Name" in a report header?
Michael Riley
Marine Corps Gunnery Sergeant (Retired)

"We may never pass this way again!"

CognosPaul

This one was tricky but I got it. The data source connection prompt creates a parameter named "credential:DATASOURCENAMEGOESHERE". In order to work with it, you'll need to know the datasource name.

In my test I took the great_outdoor_sales data source and added a new connection. When I selected the connection in the report, it created the parameter "credential:great_outdoors_sales".

Now here's the interesting thing. If you try to call that in a prompt, it won't work. It creates a text prompt but never actually submits. You can call it in a report expression with ParamDisplayValue. The value returned looks like this:

<credential><dataSourceConnection name="great_outdoors_sales1">CAMID(&quot;:&quot;)/dataSource[@name=&apos;great_outdoors_sales&apos;]/dataSourceConnection[@name=&apos;great_outdoors_sales1&apos;]</dataSourceConnection></credential>

The name always starts at position 41, and ends at the first instance of '">'.
Wrap that in a substring and position function, and you can get exactly what you need.
substring(ParamDisplayValue('credential:great_outdoors_sales'),41,
position('">',ParamDisplayValue('credential:great_outdoors_sales'))-41
)

Cape Cod Gunny

@CognosPaul Thank you very much!  ;D
This was an awesome starting point for me. My system produced slightly different results. I was able to adapt your code perfectly to work on my system.
+∞
Michael Riley
Marine Corps Gunnery Sergeant (Retired)

"We may never pass this way again!"