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?
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(":")/dataSource[@name='great_outdoors_sales']/dataSourceConnection[@name='great_outdoors_sales1']</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
)
@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.
+∞