Showing posts with label strings. Show all posts
Showing posts with label strings. Show all posts

Friday, March 9, 2012

expression-based connection strings difficult to manage

Expression-based connection strings are great but they are specific to each report which makes them difficult to maintain. Shared expression-based connection strings are not supported.

I'm looking for a way around this. I'm hoping to write a custom data extension, and in the custom data extension, do all the "dynamic" logic that sets the connection string (which you normally would be doing in your expression-based connection string).

I know the above can be done. What I don't know is how, inside a custom data extension, to get the value of expressions like User!UserID? (I want the connection to run under stored credentials, but I want to customize the connection string and add a property to it based on the UserID who is logged into Report Manager.)

Create a assembly with a static method that takes a text parameter(userid) and returns the connectionstring and add that assembly (look in BOL for custom code or something like that on how to add it to a report and deploy the assembly to the report server) and then in the datasource it is something like this =Assembly.Class.Function(User!UserID).

I have done it myself, but in my case it was depending on the reportpath.|||

Interesting workaround, SteffoS. Thanks for the reply. That may be the best available. The only downside is that you have to actually use expression-based connection strings. And in doing that, there are two unfortunate problems:

1. Every report must call that expression instead of doing development as normal

2. (More importantly) you can't preview your dataset when it's tied to an expression-based connection string. The workaround to that is switching to a shared datasource during development, then making it an expression before you deploy, but that's a pain in the rear.

Anyone else have thoughts?

Expression help needed

I use the following expression to convert zero length character strings to and int value of 0 :

comno_type == "" ? "0" : comno_type

however, some of the data I'm trying to copy contains 1 character long blank strings or " " to be precise. Can I get the above expression to handle both the zero and 1 char strings at the same time. I've tried things like:

comno_type == "", " " ? "0" : comno_type

but this is a syntax error.

Would I need to do separate expressions to handle each type of string? and if so, how do I get them into the same destination column?

Thanks

Try

(comno_type == "" || comno_type == " ") ? "0" : comno_type

Greg.
|||

Cheers , that's done the trick.

can't see the wood for the trees sometimes me, I really shouldv'e been able to work that out, is there a syntax guide for the expressions or is it in with Books Online?

|||

Yes and yes, ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/extran9/html/8b80403f-6d45-4001-8b12-25a933c663a2.htm

or

Integration Services Expression Reference
(http://msdn2.microsoft.com/en-us/library/8b80403f-6d45-4001-8b12-25a933c663a2.aspx)

|||

TRIM(comno_type) == "" ? "0" : comno_type

Wednesday, March 7, 2012

Expression based connection strings

Hi Folks,
I am having difficulty using expression based connection strings. I have
followed the instructions in this posting
http://blogs.msdn.com/bimusings/archive/2006/07/20/673051.aspx
, and as far as I can tell, I have everything set up correctly, but when I
put in the ServerName parameter and run the report I get an error,
"An error has occurred during report processing.
Cannot create a connection to data source 'AWDQuery'.
For more information about this error navigate to the report server on the
local server machine, or enable remote errors "
When I send the connection string to a text box to check it, it is fine. I
even copied it out of the text box and inserted it into another report to
ensure there wasn't a stray control character embedded. Here is the data
source connection string from the XML file.
"data source=" & Parameters!ServerName.Value & ";initial catalog=AWDQuery;"
ServerName is a valid parameter on the report.
I am using SQL Server 2005.
Any ideas?
Thanks,
BobHere is the error message from the log.
w3wp!processing!b!1/30/2007-13:29:49:: e ERROR: Data source 'BrandNew': An
error has occurred. Details:
Microsoft.ReportingServices.ReportProcessing.ReportProcessingException:
Cannot create a connection to data source 'BrandNew'. -->
System.ArgumentException: Format of the initialization string does not
conform to specification starting at index 0.
w3wp!processing!b!1/30/2007-13:29:49:: e ERROR: An exception has occurred in
data source 'BrandNew'. Details:
Microsoft.ReportingServices.ReportProcessing.ReportProcessingException:
Cannot create a connection to data source 'BrandNew'. -->
System.ArgumentException: Format of the initialization string does not
conform to specification starting at index 0.
w3wp!processing!b!1/30/2007-13:29:49:: i INFO: Merge abort handler called
for ID=-1. Aborting data sources ...
w3wp!processing!b!1/30/2007-13:29:49:: e ERROR: Throwing
Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException: An
error has occurred during report processing., ;
Info:
Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException: An
error has occurred during report processing. -->
Microsoft.ReportingServices.ReportProcessing.ReportProcessingException:
Cannot create a connection to data source 'BrandNew'. -->
System.ArgumentException: Format of the initialization string does not
conform to specification starting at index 0.
-- End of inner exception stack trace --
w3wp!webserver!b!01/30/2007-13:29:49:: e ERROR: Reporting Services error
Microsoft.ReportingServices.Diagnostics.Utilities.RSException: An error has
occurred during report processing. -->
Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException: An
error has occurred during report processing. -->
Microsoft.ReportingServices.ReportProcessing.ReportProcessingException:
Cannot create a connection to data source 'BrandNew'. -->
System.ArgumentException: Format of the initialization string does not
conform to specification starting at index 0.
"Bob McDermott" wrote:
> Hi Folks,
> I am having difficulty using expression based connection strings. I have
> followed the instructions in this posting
> http://blogs.msdn.com/bimusings/archive/2006/07/20/673051.aspx
> , and as far as I can tell, I have everything set up correctly, but when I
> put in the ServerName parameter and run the report I get an error,
> "An error has occurred during report processing.
> Cannot create a connection to data source 'AWDQuery'.
> For more information about this error navigate to the report server on the
> local server machine, or enable remote errors "
> When I send the connection string to a text box to check it, it is fine. I
> even copied it out of the text box and inserted it into another report to
> ensure there wasn't a stray control character embedded. Here is the data
> source connection string from the XML file.
> "data source=" & Parameters!ServerName.Value & ";initial catalog=AWDQuery;"
> ServerName is a valid parameter on the report.
> I am using SQL Server 2005.
> Any ideas?
> Thanks,
> Bob
>