Creating Dynamic Connections
You may want to create dynamic connections, which connect to a datasource based on external criteria. Connection elements make this possible by accepting tokens in their attributes.
In the example above, left, tokens are used for the required attributes of the Connection.SQL Server element. Another approach is to assign a complete connection string to a Session variable and use its token in the Connection String attribute, as shown above right. A value in that attribute will cause the "required" attributes to be ignored.
Or you can enter the literal connection string text into that attribute, as shown above, and tokenize parts of it, like this:
- Server=@Session.DBServer~;Database=@Session.DBName~;User Id=@Function.UserID~;Password=@Session.DBPassword~;
There are a variety of techniques available for setting the token values prior to the processing of the _Settings definition. For example, the Startup Process element, when included in _Settings, can be used to call a Process task that assigns the Session variables needed. This task will run before the Connection elements are processed.
For more information, see The _Settings Definition.
The example shown above is simplistic but shows you how to use a Process task to set Session variables, which can be used later as tokens in the Connection element's attributes. If you're unable to use the Startup Process element for some reason, you can still make the Process task run by calling it directly, rather than calling the default report definition:
- http://yourServer/yourLogiApp/rdProcess.aspx?rdProcess=yourProcessDefinition&rdTaskID=taskStartUp
Comments
0 comments
Please sign in to leave a comment.